るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.128秒)

別のキーワード

  1. prettyprint indent
  2. json indent=
  3. state indent=
  4. context auto_indent_mode=
  5. context auto_indent_mode

ライブラリ

クラス

検索結果

JSON::State#indent=(string) (33410.0)

インデントに使用する文字列をセットします。

...string インデントに使用する文字列を指定します。

//emlist[例][ruby]{
require "json"

json
_state = JSON::State.new(indent: "\t")
json
_state.indent # => "\t"
JSON
.generate({key1: "value1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"
json
_state...
....indent = " "
JSON
.generate({key1: "value1", key2: "value2"}, json_state)
# => "{ \"key1\":\"value1\", \"key2\":\"value2\"}"
//}...