るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.169秒)
トップページ > クエリ:t[x] > クエリ:Ruby[x] > 種類:インスタンスメソッド[x] > クエリ:r[x] > クエリ:JSON[x] > クラス:JSON::State[x] > クエリ:indent=[x]

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils chmod_r
  5. fileutils chown_r

ライブラリ

検索結果

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

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

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

//emlist[例][ruby]{
r
equire "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\"}"
//}...