るりまサーチ

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

別のキーワード

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

ライブラリ

検索結果

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

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

...

@
param 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\"}"
//}...