るりまサーチ

最速Rubyリファレンスマニュアル検索!
72件ヒット [1-72件を表示] (0.023秒)

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

クラス

モジュール

キーワード

検索結果

JSON::State#to_h -> Hash (18119.0)

自身をハッシュに変換します。

...シュに変換します。

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

json_state = JSON::State.new
pp json_state.to_h

# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,
# :max_nesti...

JSON::State#to_hash -> Hash (6119.0)

自身をハッシュに変換します。

...シュに変換します。

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

json_state = JSON::State.new
pp json_state.to_h

# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,
# :max_nesti...

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

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

...です。

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

@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを使用する場合指定可能...
...indent
インデントに使用する文字列を指定します。デフォルトは空文字列です。
: :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 t...
...uby]{
require "json"

JSON.generate([1, 2, { name: "tanaka", age: 19 }])
# => "[1,2,{\"name\":\"tanaka\",\"age\":19}]"
json_state = JSON::State.new(space: " ")
JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => "[1,2,{\"name\": \"tanaka\",\"age\": 19}]"
//}

@see JSON::State, JSON.#...

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

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

...です。

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

@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを使用する場合指定可能...
...indent
インデントに使用する文字列を指定します。デフォルトは空文字列です。
: :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 t...
...uby]{
require "json"

JSON.generate([1, 2, { name: "tanaka", age: 19 }])
# => "[1,2,{\"name\":\"tanaka\",\"age\":19}]"
json_state = JSON::State.new(space: " ")
JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => "[1,2,{\"name\": \"tanaka\",\"age\": 19}]"
//}

@see JSON::State, JSON.#...

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

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

...す。

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

@param options JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを使用する場合指定可能な...
..."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 (12.0)

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

...す。

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

@param options JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを使用する場合指定可能な...
..."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...