ライブラリ
- json (46)
-
json
/ add / bigdecimal (1) -
json
/ add / complex (1) -
json
/ add / date (1) -
json
/ add / date _ time (1) -
json
/ add / exception (1) -
json
/ add / ostruct (1) -
json
/ add / range (1) -
json
/ add / rational (1) -
json
/ add / regexp (1) -
json
/ add / struct (1) -
json
/ add / symbol (1) -
json
/ add / time (1) -
rdoc
/ generator / json _ index (1)
クラス
- BigDecimal (1)
- Class (1)
- Complex (1)
- Date (1)
- DateTime (1)
- Exception (1)
-
JSON
:: Parser (2) -
JSON
:: State (29) - OpenStruct (1)
-
RDoc
:: Generator :: JsonIndex (1) - Range (1)
- Rational (1)
- Regexp (1)
- Struct (1)
- Symbol (1)
- Time (1)
モジュール
-
JSON
:: Generator :: GeneratorMethods :: Array (1) -
JSON
:: Generator :: GeneratorMethods :: FalseClass (1) -
JSON
:: Generator :: GeneratorMethods :: Float (1) -
JSON
:: Generator :: GeneratorMethods :: Hash (1) -
JSON
:: Generator :: GeneratorMethods :: Integer (1) -
JSON
:: Generator :: GeneratorMethods :: NilClass (1) -
JSON
:: Generator :: GeneratorMethods :: Object (1) -
JSON
:: Generator :: GeneratorMethods :: String (3) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (1) - Kernel (3)
キーワード
- JSON (1)
- [] (1)
- []= (1)
-
allow
_ nan? (1) -
array
_ nl (1) -
array
_ nl= (1) -
ascii
_ only? (1) -
buffer
_ initial _ length (1) -
buffer
_ initial _ length= (1) -
check
_ circular? (1) - configure (1)
- depth (1)
- depth= (1)
- generate (2)
- indent (1)
- indent= (1)
- jj (1)
-
json
_ creatable? (1) -
max
_ nesting (1) -
max
_ nesting= (1) - merge (1)
-
object
_ nl (1) -
object
_ nl= (1) - parse (1)
-
quirks
_ mode (1) -
quirks
_ mode= (1) -
quirks
_ mode? (1) - source (1)
- space (1)
- space= (1)
-
space
_ before (1) -
space
_ before= (1) -
to
_ h (1) -
to
_ hash (1) -
to
_ json (21) -
to
_ json _ raw (1) -
to
_ json _ raw _ object (1)
検索結果
先頭5件
- JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw -> String - JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String - JSON
:: Generator :: GeneratorMethods :: String # to _ json(state _ or _ hash = nil) -> String - JSON
:: Generator :: GeneratorMethods :: Array # to _ json(state _ or _ hash = nil) -> String - JSON
:: Generator :: GeneratorMethods :: FalseClass # to _ json(state _ or _ hash = nil) -> String
-
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw -> String (78871.0) -
自身に対して JSON::Generator::GeneratorMethods::String#to_json_raw_object を呼び出して JSON::Generator::GeneratorMethods::Hash#to_json した結果を返します。
自身に対して JSON::Generator::GeneratorMethods::String#to_json_raw_object を呼び出して JSON::Generator::GeneratorMethods::Hash#to_json した結果を返します。
@see JSON::Generator::GeneratorMethods::String#to_json_raw_object, JSON::Generator::GeneratorMethods::Hash#to_json -
JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (78799.0) -
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
このメソッドはあるオブジェクトに to_json メソッドが定義されていない場合に使用する
フォールバックのためのメソッドです。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json(state _ or _ hash = nil) -> String (78799.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
自身のエンコードは UTF-8 であるべきです。
"\u????" のように UTF-16 ビッグエンディアンでエンコードされた文字列を返すことがあります。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]... -
JSON
:: Generator :: GeneratorMethods :: Array # to _ json(state _ or _ hash = nil) -> String (78745.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
[1, 2, 3].to_json # => "[1,2,3]"
//} -
JSON
:: Generator :: GeneratorMethods :: FalseClass # to _ json(state _ or _ hash = nil) -> String (78745.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"false" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
false.to_json # => "false"
//} -
JSON
:: Generator :: GeneratorMethods :: Float # to _ json(state _ or _ hash = nil) -> String (78745.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
(1.0).to_json # => "1.0"
//} -
JSON
:: Generator :: GeneratorMethods :: Hash # to _ json(state _ or _ hash = nil) -> String (78745.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
person = { "name" => "tanaka", "age" => 19 }
person.to_json # ... -
JSON
:: Generator :: GeneratorMethods :: Integer # to _ json(state _ or _ hash = nil) -> String (78745.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
10.to_json # => "10"
//} -
JSON
:: Generator :: GeneratorMethods :: NilClass # to _ json(state _ or _ hash = nil) -> String (78745.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"null" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
nil.to_json # => "null"
//} -
JSON
:: Generator :: GeneratorMethods :: TrueClass # to _ json(state _ or _ hash = nil) -> String (78745.0) -
自身から生成した JSON 形式の文字列を返します。
自身から生成した JSON 形式の文字列を返します。
"true" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
true.to_json # => "true"
//} -
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw _ object -> Hash (78715.0) -
生の文字列を格納したハッシュを生成します。
生の文字列を格納したハッシュを生成します。
このメソッドは UTF-8 の文字列ではなく生の文字列を JSON に変換する場合に使用してください。
require 'json'
"にほんご".encode("euc-jp").to_json_raw_object
# => {"json_class"=>"String", "raw"=>[164, 203, 164, 219, 164, 243, 164, 180]}
"にほんご".encode("euc-jp").to_json # source sequence is illegal/malformed (JSON::... -
Kernel
# j(*objects) -> nil (78409.0) -
与えられたオブジェクトを JSON 形式の文字列で標準出力に一行で出力します。
与えられたオブジェクトを JSON 形式の文字列で標準出力に一行で出力します。
@param objects JSON 形式で出力したいオブジェクトを指定します。
//emlist[例][ruby]{
require "json"
j([1,2,{"name" => "tanaka","age" => 19}])
# => [1,2,{"name":"tanaka","age":19}]
//}
@see Kernel.#p -
Kernel
# JSON(object , options = {}) -> object (60817.0) -
第一引数に与えられたオブジェクトの種類によって Ruby のオブジェクトか JSON 形式の文字列を返します。
第一引数に与えられたオブジェクトの種類によって Ruby のオブジェクトか JSON 形式の文字列を返します。
第一引数に文字列のようなオブジェクトを指定した場合は、それを JSON.#parse を用いてパースした結果を返します。
そうでないオブジェクトを指定した場合は、それを JSON.#generate を用いて変換した結果を返します。
@param object 任意のオブジェクトを指定します。
@param options JSON.#parse, JSON.#generate に渡すオプションを指定します。
//emlist[例][ruby]{
require "json... -
Class
# json _ creatable? -> bool (60745.0) -
シリアライズされた JSON 形式の文字列から、インスタンスを作成するのにこのクラスを使用できる場合は 真を返します。そうでない場合は、偽を返します。
シリアライズされた JSON 形式の文字列から、インスタンスを作成するのにこのクラスを使用できる場合は
真を返します。そうでない場合は、偽を返します。
このメソッドが真を返すクラスは json_create というメソッドを実装していなければなりません。
また json_create の第一引数は必要なデータを含むハッシュを期待しています。
//emlist[例][ruby]{
require "json"
String.json_creatable? # => true
Dir.json_creatable? # => false
//} -
JSON
:: State # object _ nl -> String (51550.0) -
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を返します。
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を返します。
//emlist[例][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:... -
JSON
:: State # object _ nl=(string) (51550.0) -
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列をセットします。
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列をセットします。
@param string JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を指定します。
//emlist[例][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 # generate(obj) -> String (42400.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. -
Kernel
# jj(*objects) -> nil (42388.0) -
与えられたオブジェクトを JSON 形式の文字列で標準出力に人間に読みやすく整形して出力します。
与えられたオブジェクトを JSON 形式の文字列で標準出力に人間に読みやすく整形して出力します。
@param objects JSON 形式で出力したいオブジェクトを指定します。
//emlist[例][ruby]{
require "json"
jj([1,2,{"name" => "tanaka","age" => 19}])
# => [
# 1,
# 2,
# {
# "name": "tanaka",
# "age": 19
# }
# ]
//}
@see Kernel.#pp -
JSON
:: Parser # parse -> object (42358.0) -
現在のソースをパースして結果を Ruby のオブジェクトとして返します。
現在のソースをパースして結果を Ruby のオブジェクトとして返します。
//emlist[例][ruby]{
require 'json'
class Person
attr_accessor :name, :age
def []=(key, value)
instance_variable_set("@#{key}", value)
end
end
parser = JSON::Parser.new(DATA.read, object_class: Person)
person = parser.parse
person.class # => Person
p... -
JSON
:: State # max _ nesting -> Integer (42322.0) -
生成される JSON 形式の文字列のネストの深さの最大値を返します。
生成される JSON 形式の文字列のネストの深さの最大値を返します。
この値がゼロである場合は、ネストの深さのチェックを行いません。
//emlist[例 ネストの深さチェックを行う][ruby]{
require "json"
json_state = JSON::State.new(max_nesting: 2)
json_state.max_nesting # => 2
JSON.generate([[]], json_state)
JSON.generate([[[]]], json_state) # => JSON::NestingError
//}
... -
JSON
:: State # [](name) -> object (42304.0) -
Return the value returned by method name.
Return the value returned by method name. -
JSON
:: State # max _ nesting=(depth) (42250.0) -
生成される JSON 形式の文字列のネストの深さの最大値をセットします。
生成される JSON 形式の文字列のネストの深さの最大値をセットします。
この値にゼロをセットすると、ネストの深さのチェックを行いません。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(max_nesting: 2)
json_state.max_nesting # => 2
JSON.generate([[]], json_state)
json_state.max_nesting = 3
json_state.max_nesting # => 3
JSON.g... -
JSON
:: State # space -> String (42250.0) -
JSON 形式の文字列のトークン間に挿入する文字列を返します。
JSON 形式の文字列のトークン間に挿入する文字列を返します。
//emlist[例][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_... -
JSON
:: State # space=(string) (42250.0) -
JSON 形式の文字列のトークン間に挿入する文字列をセットします。
JSON 形式の文字列のトークン間に挿入する文字列をセットします。
@param string JSON 形式の文字列のトークン間に挿入する文字列を指定します。
//emlist[例][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 # space _ before -> String (42250.0) -
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の 前に挿入する文字列を返します。
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の
前に挿入する文字列を返します。
//emlist[例][ruby]{
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}]
js... -
JSON
:: State # space _ before=(string) (42250.0) -
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の 前に挿入する文字列をセットします。
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の
前に挿入する文字列をセットします。
@param string JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の
前に挿入する文字列をセットします。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(space_before: "")
json_state.space_before # => ""
puts JSON.gen... -
JSON
:: State # configure(options = {}) -> self (42220.0) -
与えられたハッシュで自身を設定します。
与えられたハッシュで自身を設定します。
オプションで使用するハッシュのキーについては JSON::State.new を参照してください。
@param options このオブジェクトの設定をするためのハッシュを指定します。
//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\... -
JSON
:: State # merge(options = {}) -> self (42220.0) -
与えられたハッシュで自身を設定します。
与えられたハッシュで自身を設定します。
オプションで使用するハッシュのキーについては JSON::State.new を参照してください。
@param options このオブジェクトの設定をするためのハッシュを指定します。
//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\... -
JSON
:: State # check _ circular? -> bool (42184.0) -
循環参照のチェックを行う場合は、真を返します。 そうでない場合は偽を返します。
循環参照のチェックを行う場合は、真を返します。
そうでない場合は偽を返します。
//emlist[例 ネストをチェックするケース][ruby]{
require "json"
a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]... -
JSON
:: State # array _ nl -> String (42178.0) -
JSON の配列の後に出力する文字列を返します。
JSON の配列の後に出力する文字列を返します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new({})
json_state.array_nl # => ""
json_state = JSON::State.new(array_nl: "\n")
json_state.array_nl # => "\n"
//} -
JSON
:: State # indent=(string) (42166.0) -
インデントに使用する文字列をセットします。
インデントに使用する文字列をセットします。
@param string インデントに使用する文字列を指定します。
//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.indent = "... -
JSON
:: State # array _ nl=(str) (42160.0) -
JSON の配列の後に出力する文字列をセットします。
JSON の配列の後に出力する文字列をセットします。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new({})
json_state.array_nl # => ""
json_state.array_nl = "\n"
json_state.array_nl # => "\n"
//} -
JSON
:: State # allow _ nan? -> bool (42130.0) -
NaN, Infinity, -Infinity を生成できる場合、真を返します。 そうでない場合は偽を返します。
NaN, Infinity, -Infinity を生成できる場合、真を返します。
そうでない場合は偽を返します。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new({})
json_state.allow_nan? # => false
json_state = JSON::State.new(allow_nan: true)
json_state.allow_nan? # => true
//}
@see 4627 -
JSON
:: State # indent -> String (42112.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 # to _ h -> Hash (42076.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_nesting=>100,
# ... -
JSON
:: State # to _ hash -> Hash (42076.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_nesting=>100,
# ... -
JSON
:: State # ascii _ only? -> bool (42052.0) -
ASCII 文字列のみを用いて JSON 形式の文字列を生成する場合に真を返します。 そうでない場合に偽を返します。
ASCII 文字列のみを用いて JSON 形式の文字列を生成する場合に真を返します。
そうでない場合に偽を返します。 -
JSON
:: State # depth=(depth) (42052.0) -
This sets the maximum level of data structure nesting in the generated JSON to the integer depth, max_nesting = 0 if no maximum should be checked.
This sets the maximum level of data structure nesting in the generated
JSON to the integer depth, max_nesting = 0 if no maximum should be
checked. -
JSON
:: Parser # source -> String (42040.0) -
現在のソースのコピーを返します。
現在のソースのコピーを返します。
//emlist[例][ruby]{
require 'json'
parser = JSON::Parser.new(DATA.read)
print parser.source
# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# => "name":"suzuki",
# => "age":25
# => }
# => }
__END__
{
"Tanaka": {
... -
JSON
:: State # []=(name , value) (42004.0) -
Set the attribute name to value.
Set the attribute name to value. -
JSON
:: State # buffer _ initial _ length -> Integer (42004.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) (42004.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 # depth -> Integer (42004.0) -
This integer returns the current depth of data structure nesting.
This integer returns the current depth of data structure nesting. -
JSON
:: State # quirks _ mode -> bool (42004.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) (42004.0) -
If set to true, enables the quirks_mode mode.
If set to true, enables the quirks_mode mode. -
JSON
:: State # quirks _ mode? -> bool (42004.0) -
Returns true, if quirks mode is enabled. Otherwise returns false.
Returns true, if quirks mode is enabled. Otherwise returns false. -
Date
# to _ json(*args) -> String (36817.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
Date.today.to_json
# => "{\"json_class\":\"Date\",\"y\":2018,\"m\":12... -
DateTime
# to _ json(*args) -> String (36817.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
DateTime.now.to_json
# => "{\"json_class\":\"DateTime\",\"y\":2018,\"... -
Exception
# to _ json(*args) -> String (36817.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
begin
0/0
rescue => e
e.to_json # => "{\"json_class\":\"ZeroDivis... -
Range
# to _ json(*args) -> String (36817.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
(1..5).to_json # => "{\"json_class\":\"Range\",\"a\":[1,5,false]}"
//... -
Struct
# to _ json(*args) -> String (36817.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
Person = Struct.new(:name, :age)
Person.new("tanaka", 29).to_json # =... -
Time
# to _ json(*args) -> String (36817.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
Time.now.to_json # => "{\"json_class\":\"Time\",\"s\":1544968675,\"n\... -
BigDecimal
# to _ json(*args) -> String (36781.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 使用しません。
//emlist[例][ruby]{
require 'json/add/bigdecimal'
BigDecimal('0.123456789123456789').to_json # => "{\"json_class\":\"BigDecimal\",\"b\":\"36:0.123456789123456789e0\"}"
//... -
Complex
# to _ json(*args) -> String (36781.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 使用しません。
//emlist[例][ruby]{
require 'json/add/complex'
Complex(2, 3).to_json # => "{\"json_class\":\"Complex\",\"r\":2,\"i\":3}"
//}
@see JSON::Generator::GeneratorMethods::Hash... -
Rational
# to _ json(*args) -> String (36781.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 使用しません。
//emlist[例][ruby]{
require 'json/add/rational'
Rational(1, 3).to_json # => "{\"json_class\":\"Rational\",\"n\":1,\"d\":3}"
//}
@see JSON::Generator::GeneratorMethods::H... -
OpenStruct
# to _ json(*args) -> String (36763.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
@see JSON::Generator::GeneratorMethods::Hash#to_json -
Symbol
# to _ json(*args) -> String (36763.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
@see JSON::Generator::GeneratorMethods::Hash#to_json -
Regexp
# to _ json(*args) -> String (36745.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数には何の意味もありません。
//emlist[例][ruby]{
require "json/add/core"
/0\d{1,4}-\d{1,4}-\d{4}/.to_json # => "{\"json_class\":\"Regexp\",\"o\":0,\"s\":\"0\\\\d{1,4}-\\\\d{1,4}-\\\\d{4}\"}"... -
RDoc
:: Generator :: JsonIndex # generate -> () (18004.0) -
解析した情報を RDoc::Generator::JsonIndex::SEARCH_INDEX_FILE に出 力します。
解析した情報を RDoc::Generator::JsonIndex::SEARCH_INDEX_FILE に出
力します。