るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.029秒)
トップページ > クエリ:state[x] > クエリ:indent=[x]

別のキーワード

  1. json state
  2. random state
  3. _builtin state
  4. state indent

ライブラリ

クラス

検索結果

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

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

...quire "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\"...