るりまサーチ

最速Rubyリファレンスマニュアル検索!
48件ヒット [1-48件を表示] (0.144秒)
トップページ > クエリ:t[x] > 種類:モジュール関数[x] > クエリ:pretty_generate[x]

別のキーワード

  1. json pretty_generate
  2. json pretty_unparse
  3. cgi pretty
  4. pp pretty_inspect
  5. pp pretty_print

ライブラリ

モジュール

キーワード

検索結果

JSON.#pretty_generate(object, options = nil) -> String (24220.0)

Ruby のオブジェクトを JSON 形式の文字列に変換して返します。

...は JSON.#generate よりも人間に読みやすい文字列を返します。

pretty_unparse は将来削除される予定です。

@param object JSON 形式の文字列に変換するオブジェクトを指定します。

@param options JSON::State または、to_hash や to_h メソッド...
...te を参照してください。

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

hash = { "name": "tanaka", "age": 19 }
puts JSON.generate(hash)
# => {"name":"tanaka","age":19}

puts JSON.pretty_generate(hash)
# => {
# "name": "tanaka",
# "age": 19
# }

puts JSON.pretty_generate(hash, space: "\t...
...")
# => {
# "name": "tanaka",
# "age": 19
# }
//}

@see JSON.#generate...

JSON.#pretty_unparse(object, options = nil) -> String (9120.0)

Ruby のオブジェクトを JSON 形式の文字列に変換して返します。

...は JSON.#generate よりも人間に読みやすい文字列を返します。

pretty_unparse は将来削除される予定です。

@param object JSON 形式の文字列に変換するオブジェクトを指定します。

@param options JSON::State または、to_hash や to_h メソッド...
...te を参照してください。

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

hash = { "name": "tanaka", "age": 19 }
puts JSON.generate(hash)
# => {"name":"tanaka","age":19}

puts JSON.pretty_generate(hash)
# => {
# "name": "tanaka",
# "age": 19
# }

puts JSON.pretty_generate(hash, space: "\t...
...")
# => {
# "name": "tanaka",
# "age": 19
# }
//}

@see JSON.#generate...

JSON.#generate(object, state = nil) -> String (6207.0)

与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。

...N::NaN, JSON::Infinity,
JSON::MinusInfinity を生成することもありません。

unparse は将来削除される予定です。

@param object JSON 形式の文字列に変換するオブジェクトを指定します。

@param state JSON::State または、to_hash や to_h メソッドで...
...dent
インデントに使用する文字列を指定します。デフォルトは空文字列です。
: :space
a string that is put after, a : or , delimiter (default: '')
: :space_before
a string that is put before a : pair delimiter (default: '')
: :object_nl
a string that is put at the...
...end of a JSON object (default: '')
: :array_nl
a string that is put at the end of a JSON array (default: '')
: :check_circular
真を指定した場合、生成するオブジェクトの循環をチェックします。
この動作がデフォルトです。
: :allow_nan
真を指定し...

JSON.#unparse(object, state = nil) -> String (3107.0)

与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。

...N::NaN, JSON::Infinity,
JSON::MinusInfinity を生成することもありません。

unparse は将来削除される予定です。

@param object JSON 形式の文字列に変換するオブジェクトを指定します。

@param state JSON::State または、to_hash や to_h メソッドで...
...dent
インデントに使用する文字列を指定します。デフォルトは空文字列です。
: :space
a string that is put after, a : or , delimiter (default: '')
: :space_before
a string that is put before a : pair delimiter (default: '')
: :object_nl
a string that is put at the...
...end of a JSON object (default: '')
: :array_nl
a string that is put at the end of a JSON array (default: '')
: :check_circular
真を指定した場合、生成するオブジェクトの循環をチェックします。
この動作がデフォルトです。
: :allow_nan
真を指定し...