Skip to content

Commit

Permalink
Merge pull request #1629 from tbpgr/add_sample_code_of_json_m_generate
Browse files Browse the repository at this point in the history
Add sample code of JSON.generate
  • Loading branch information
hanachin authored Feb 4, 2020
2 parents 2ee2d9e + 0a7e8f6 commit 5aa0a74
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions refm/api/src/json/JSON
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ unparse は将来削除される予定です。

@raise JSON::CircularDatastructure 与えられたオブジェクトが循環参照を持つ場合に発生します。

#@samplecode 例
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}]"
#@end

@see [[c:JSON::State]], [[m:JSON.#pretty_generate]]

--- load(source, proc = nil, options = {}) -> object
Expand Down

0 comments on commit 5aa0a74

Please sign in to comment.