るりまサーチ (Ruby 2.5.0)

最速Rubyリファレンスマニュアル検索!
18件ヒット [1-18件を表示] (0.128秒)
トップページ > クエリ:l[x] > バージョン:2.5.0[x] > クエリ:r[x] > クエリ:u[x] > ライブラリ:json[x]

別のキーワード

  1. matrix l
  2. kernel $-l
  3. _builtin $-l
  4. lupdecomposition l
  5. l

検索結果

JSON::Ext::Generator::GeneratorMethods::TrueClass (63007.0)

Alias of JSON::Generator::GeneratorMethods::TrueClass

...Alias of JSON::Generator::GeneratorMethods::TrueClass...

JSON::Generator::GeneratorMethods::TrueClass (63007.0)

TrueClass に JSON で使用するインスタンスメソッドを追加するためのモジュールです。

...TrueClass に JSON で使用するインスタンスメソッドを追加するためのモジュールです。...

JSON::State#buffer_initial_length -> Integer (54907.0)

This integer returns the current initial length of the buffer.

This integer returns the current initial length of the buffer.

JSON::State#buffer_initial_length=(length) (54907.0)

This sets the initial length of the buffer to length, if length > 0, otherwise its value isn't changed.

This sets the initial length of the buffer to length, if length > 0,
otherwise its value isn't changed.

JSON::State#check_circular? -> bool (54907.0)

循環参照のチェックを行う場合は、真を返します。 そうでない場合は偽を返します。

...y]{
require "json"

a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s = JSON.state.new
begin
JSON
.generate(a, s)
rescue JSON::NestingErr...
...or => e
[e, s.max_nesting, s.check_circular?] # => [#<JSON::NestingError: nesting of 100 is too deep>, 100, true]
end
//}

//emlist[例 ネストをチェックしないケース][ruby]{
require "json"

a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[...
...[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s2 = JSON.state.new(max_nesting: 0)
json
= JSON.generate(a, s2)
[json, s2.max_nesting, s2.check_circular?] # => ["[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[...

絞り込み条件を変える

JSON::CircularDatastructure (54007.0)

JSON 形式の文字列を生成するときに循環するデータ構造があるときに発生する例外です。

...JSON 形式の文字列を生成するときに循環するデータ構造があるときに発生する例外です。...

JSON::State#configure(options = {}) -> self (36907.0)

与えられたハッシュで自身を設定します。

...ーについては JSON::State.new を参照してください。

@param options このオブジェクトの設定をするためのハッシュを指定します。

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

json
_state = JSON::State.new(indent: "\t")
json
_state.indent # => "\t"
JSON
.generate({key1: "va...
...lue1", 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#quirks_mode -> bool (36907.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=(enable) (36907.0)

If set to true, enables the quirks_mode mode.

If set to true, enables the quirks_mode mode.

JSON::State#quirks_mode? -> bool (36907.0)

Returns true, if quirks mode is enabled. Otherwise returns false.

Returns true, if quirks mode is enabled. Otherwise returns false.

絞り込み条件を変える

JSON::Generator::GeneratorMethods::TrueClass#to_json(state_or_hash = nil) -> String (36607.0)

自身から生成した JSON 形式の文字列を返します。

...ら生成した JSON 形式の文字列を返します。

"true" という文字列を返します。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
JSON::State のインスタンスか、
JSON
::State.new の...
...引数と同じ Hash を
指定します。

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

true.to_json # => "true"
//}...

JSON.#restore(source, proc = nil, options = {}) -> object (28207.0)

与えられた JSON 形式の文字列を Ruby オブジェクトとしてロードして返します。

... JSON 形式の文字列を Ruby オブジェクトとしてロードして返します。

proc として手続きオブジェクトが与えられた場合は、読み込んだオブジェクトを
引数にその手続きを呼び出します。


require 'json'

str=<<JSON
[1,2,3]
JSON
...
...

JSON
.load(str) # => [1,2,3]
JSON
.load(str, proc{|v| p v }) # => [1,2,3]
# 以下が表示される
# 1
# 2
# 3
# [1,2,3]

str=<<JSON
{ "a":1, "b":2, "c":3 }
JSON


JSON
.load(str) # => {"a"=>1, "b"=>2, "c"=>3}
JSON
.load(str, proc{|v| p v }) # => {"a"=>1, "b"=>2, "c"=>3}...
...# 以下が表示される
# "a"
# 1
# "b"
# 2
# "c"
# 3
# {"a"=>1, "b"=>2, "c"=>3}

@param source JSON 形式の文字列を指定します。他には、to_str, to_io, read メソッドを持つオブジェクトも指定可能です。

@param proc Proc オブジェクトを指...

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

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

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

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

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

@param object JSON 形式の文字列に変換するオブ...
...options JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを使用する場合指定可能なオプションは JSON.#generate を参照してください。

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

hash...
..."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.#unparse(object, state = nil) -> String (27907.0)

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

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

デフォルトでは、サイズが最小となる JSON 形式の文字列を生成します。
また、循環参照のチェックを行います。JSON::NaN, JSON::Infinity,
JSON
::MinusInfinity を生成する...
...こともありません。

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

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

@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定で...
...tring 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
真を指定した場合、生成するオブジェクトの循環...

JSON::State#merge(options = {}) -> self (27607.0)

与えられたハッシュで自身を設定します。

...ーについては JSON::State.new を参照してください。

@param options このオブジェクトの設定をするためのハッシュを指定します。

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

json
_state = JSON::State.new(indent: "\t")
json
_state.indent # => "\t"
JSON
.generate({key1: "va...
...lue1", 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.#dump(object, io = nil, limit = nil) -> String | IO (18907.0)

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

...与えられたオブジェクトを JSON 形式の文字列に変換してダンプします。

与えられたオブジェクトを引数として JSON.#generate を呼び出します。


@param object ダンプするオブジェクトを指定します。

@param io IO のように write メ...
...//emlist[例][ruby]{
require "json"

JSON
.dump({ name: "tanaka", age: 19 }) # => "{\"name\":\"tanaka\",\"age\":19}"
//}

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

File.open("test.txt", "w") do |f|
JSON
.dump([[[[[[[[[[]]]]]]]]]], f, 10) # => #<File:test.txt>
JSON
.dump([[[[[[[[[[[]]]]]]]]]]], f, 10...

JSON.#load(source, proc = nil, options = {}) -> object (18907.0)

与えられた JSON 形式の文字列を Ruby オブジェクトとしてロードして返します。

... JSON 形式の文字列を Ruby オブジェクトとしてロードして返します。

proc として手続きオブジェクトが与えられた場合は、読み込んだオブジェクトを
引数にその手続きを呼び出します。


require 'json'

str=<<JSON
[1,2,3]
JSON
...
...

JSON
.load(str) # => [1,2,3]
JSON
.load(str, proc{|v| p v }) # => [1,2,3]
# 以下が表示される
# 1
# 2
# 3
# [1,2,3]

str=<<JSON
{ "a":1, "b":2, "c":3 }
JSON


JSON
.load(str) # => {"a"=>1, "b"=>2, "c"=>3}
JSON
.load(str, proc{|v| p v }) # => {"a"=>1, "b"=>2, "c"=>3}...
...# 以下が表示される
# "a"
# 1
# "b"
# 2
# "c"
# 3
# {"a"=>1, "b"=>2, "c"=>3}

@param source JSON 形式の文字列を指定します。他には、to_str, to_io, read メソッドを持つオブジェクトも指定可能です。

@param proc Proc オブジェクトを指...

JSON::Generator::GeneratorMethods::String#to_json(state_or_hash = nil) -> String (18661.0)

自身から生成した JSON 形式の文字列を返します。

...ら生成した JSON 形式の文字列を返します。

自身のエンコードは UTF-8 であるべきです。
"\u????" のように UTF-16 ビッグエンディアンでエンコードされた文字列を返すことがあります。

@param state_or_hash 生成する JSON 形式の文字...
... JSON::State のインスタンスか、
JSON
::State.new の引数と同じ Hash を
指定します。

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

puts "test".to_json # => "test"
puts '"'.to_json #...
...=> "\""
puts "\\".to_json # => "\\"
puts "𤘩宮城".to_json(ascii_only: true) # => "\ud851\ude29\u5bae\u57ce"
//}...