種類
- インスタンスメソッド (209)
- 特異メソッド (22)
ライブラリ
- json (231)
キーワード
- [] (11)
-
allow
_ nan? (11) -
array
_ nl (11) -
ascii
_ only? (11) -
buffer
_ initial _ length (11) -
check
_ circular? (11) - configure (11)
- depth (11)
-
from
_ state (11) - generate (11)
- indent (11)
-
max
_ nesting (11) - merge (11)
- new (11)
-
object
_ nl (11) -
quirks
_ mode (11) -
quirks
_ mode? (11) - space (11)
-
space
_ before (11) -
to
_ h (11) -
to
_ hash (11)
検索結果
先頭5件
-
JSON
:: State # depth -> Integer (3101.0) -
This integer returns the current depth of data structure nesting.
This integer returns the current depth of data structure nesting. -
JSON
:: State # generate(obj) -> String (3101.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.
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. -
JSON
:: State # indent -> String (3101.0) -
インデントに使用する文字列を返します。
...インデントに使用する文字列を返します。
//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 # max _ nesting -> Integer (3101.0) -
生成される JSON 形式の文字列のネストの深さの最大値を返します。
...n"
json_state = JSON::State.new(max_nesting: 2)
json_state.max_nesting # => 2
JSON.generate([[]], json_state)
JSON.generate([[[]]], json_state) # => JSON::NestingError
//}
//emlist[例 ネストの深さチェックを行わない][ruby]{
require "json"
json_state = JSON::State.new(max......_nesting: 0)
json_state.max_nesting # => 0
JSON.generate([[[[[[[[[[]]]]]]]]]], json_state)
//}... -
JSON
:: State # merge(options = {}) -> self (3101.0) -
与えられたハッシュで自身を設定します。
...シュのキーについては JSON::State.new を参照してください。
@param options このオブジェクトの設定をするためのハッシュを指定します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(indent: "\t")
json_state.indent # => "\t"
JSON.generat......y1: "value1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"
json_state.configure(indent: " ")
json_state.indent # => " "
JSON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{ \"key1\":\"value1\", \"key2\":\"value2\"}"
//}
@see JSON::State.new... -
JSON
:: State # object _ nl -> String (3101.0) -
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を返します。
...[ruby]{
require "json"
json_state = JSON::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 # quirks _ mode -> bool (3101.0) -
Returns true, if quirks mode is enabled. Otherwise returns false.
Returns true, if quirks mode is enabled. Otherwise returns false. -
JSON
:: State # quirks _ mode? -> bool (3101.0) -
Returns true, if quirks mode is enabled. Otherwise returns false.
Returns true, if quirks mode is enabled. Otherwise returns false. -
JSON
:: State # space -> String (3101.0) -
JSON 形式の文字列のトークン間に挿入する文字列を返します。
...t[例][ruby]{
require "json"
json_state = JSON::State.new(space: "")
json_state.space # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name":"tanaka","age":19}]
json_state = JSON::State.new(space: "\t")
json_state.space # => "\t"
puts......JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name": "tanaka","age": 19}]
//}... -
JSON
:: State # space _ before -> String (3101.0) -
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の 前に挿入する文字列を返します。
...y]{
require "json"
json_state = JSON::State.new(space_before: "")
json_state.space_before # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name":"tanaka","age":19}]
json_state = JSON::State.new(space_before: " ")
json_state.space_before......# => " "
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name" :"tanaka","age" :19}]
//}...