るりまサーチ

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

別のキーワード

  1. openssl public_key
  2. _builtin each_key
  3. openssl public_key=
  4. dbm key
  5. socket pf_key

ライブラリ

クラス

検索結果

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

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

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

//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.i...
...ndent = " "
JSON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{ \"key1\":\"value1\", \"key2\":\"value2\"}"
//}...