るりまサーチ

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

別のキーワード

  1. objectspace each_object
  2. _builtin each_object
  3. object to_enum
  4. object send
  5. object enum_for

ライブラリ

クラス

モジュール

キーワード

検索結果

JSON::State#object_nl -> String (18238.0)

JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を返します。

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

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

# => [1,2,{
# "name":"tanaka",
# "age":19
# }]
//}...

JSON::State#generate(obj) -> String (18218.0)

Generates a valid JSON document from object obj and returns the result. If no valid JSON document can be created this method raises a GeneratorError exception.

...
Generate
s a valid JSON document from object obj and returns the
result. If no valid JSON document can be created this method raises a
GeneratorError exception....

Kernel#JSON(object, options = {}) -> object (327.0)

第一引数に与えられたオブジェクトの種類によって Ruby のオブジェクトか JSON 形式の文字列を返します。

...N.#generate を用いて変換した結果を返します。

@param object 任意のオブジェクトを指定します。

@param options JSON.#parse, JSON.#generate に渡すオプションを指定します。

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

JSON('[1,2,{"name":"tanaka","age":19}]')
# => [...
...1, 2, {"name"=>"tanaka", "age"=>19}]

JSON('[1,2,{"name":"tanaka","age":19}]', symbolize_names: true)
# => [1, 2, {:name=>"tanaka", :age=>19}]
//}

@see JSON.#parse, JSON.#generate...