1028件ヒット
[1-100件を表示]
(0.156秒)
ライブラリ
- ビルトイン (7)
- json (704)
-
json
/ add / bigdecimal (22) -
json
/ add / complex (22) -
json
/ add / date (11) -
json
/ add / date _ time (22) -
json
/ add / exception (22) -
json
/ add / ostruct (11) -
json
/ add / range (11) -
json
/ add / rational (22) -
json
/ add / regexp (11) -
json
/ add / struct (11) -
json
/ add / symbol (11) -
json
/ add / time (22) -
json
/ editor (11) - psych (11)
-
rdoc
/ generator / json _ index (44)
クラス
- BigDecimal (22)
- Complex (22)
- Date (11)
- DateTime (22)
- Exception (22)
-
JSON
:: Parser (22) -
JSON
:: State (231) - Object (7)
- OpenStruct (11)
-
RDoc
:: Generator :: JsonIndex (33) - Range (11)
- Rational (22)
- Regexp (11)
- Struct (11)
- Symbol (11)
- Time (22)
モジュール
- JSON (165)
-
JSON
:: Generator :: GeneratorMethods :: Array (11) -
JSON
:: Generator :: GeneratorMethods :: FalseClass (11) -
JSON
:: Generator :: GeneratorMethods :: Float (11) -
JSON
:: Generator :: GeneratorMethods :: Hash (11) -
JSON
:: Generator :: GeneratorMethods :: Integer (11) -
JSON
:: Generator :: GeneratorMethods :: NilClass (11) -
JSON
:: Generator :: GeneratorMethods :: Object (11) -
JSON
:: Generator :: GeneratorMethods :: String (33) -
JSON
:: Generator :: GeneratorMethods :: String :: Extend (11) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (11) - Kernel (33)
- Psych (11)
キーワード
- CircularDatastructure (11)
- Editor (11)
- Extend (22)
- Integer (22)
- JsonIndex (11)
- MissingUnicodeSupport (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - NestingError (11)
- NilClass (22)
-
SEARCH
_ INDEX _ FILE (11) - String (22)
-
VARIANT
_ BINARY (11) - VERSION (11)
-
array
_ nl (11) -
buffer
_ initial _ length (11) -
buffer
_ initial _ length= (11) -
check
_ circular? (11) - configure (11)
-
create
_ id (11) -
create
_ id= (11) - depth (11)
- dump (11)
-
fast
_ generate (11) -
fast
_ unparse (11) -
from
_ state (11) - generate (33)
- indent (11)
- indent= (11)
- j (11)
- jj (11)
-
json
/ add / rational (11) -
json
/ editor (11) -
json
_ create (77) - load (11)
-
max
_ nesting (11) - merge (11)
- new (22)
-
object
_ nl (11) -
object
_ nl= (11) - parse (11)
- parse! (11)
-
pretty
_ generate (11) -
pretty
_ unparse (11) -
quirks
_ mode (11) -
quirks
_ mode= (11) -
quirks
_ mode? (11) -
rdoc
/ generator / json _ index (11) - restore (11)
- source (11)
- space (11)
- space= (11)
-
space
_ before (11) -
space
_ before= (11) -
to
_ json (242) -
to
_ json _ raw (11) -
to
_ json _ raw _ object (11) - unparse (11)
-
yield
_ self (7)
検索結果
先頭5件
-
JSON
. create _ id=(identifier) (33394.0) -
json_create メソッドで使用するクラスを決定するために使用する値をセットします。
...
json_create メソッドで使用するクラスを決定するために使用する値をセットします。
@param identifier 識別子を指定します。
//emlist[例][ruby]{
require "json"
require "json/add/core"
JSON.create_id # => "json_class"
puts (1..5).to_json......# => {"json_class":"Range","a":[1,5,false]}
JSON.create_id = "my_json_class" # => "my_json_class"
JSON.create_id # => "my_json_class"
puts (1..5).to_json # => {"my_json_class":"Range","a":[1,5,false]}
//}... -
JSON
. create _ id -> String (33300.0) -
json_create メソッドで使用するクラスを決定するために使用する値を返します。
...
json_create メソッドで使用するクラスを決定するために使用する値を返します。
デフォルトは "json_class" です。
//emlist[例][ruby]{
require "json"
class User
attr :id, :name
def initialize(id, name)
@id, @name = id, name
end
def self.json_create(......new(object['id'], object["name"])
end
def as_json(*)
{
JSON.create_id => self.class.name,
"id" => id,
"name" => name,
}
end
def to_json(*)
as_json.to_json
end
end
json = JSON.generate(User.new(1, "tanaka"))
json # => "{\"json_class\":\"User\",\"id\":1,\"nam......e\":\"tanaka\"}"
JSON.parse(json, create_additions: true)
# => #<User:0x0000557709b269e0 @id=1, @name="tanaka">
//}... -
JSON
:: VERSION -> String (33201.0) -
このライブラリのバージョンを表す文字列です。
このライブラリのバージョンを表す文字列です。 -
JSON
:: VARIANT _ BINARY -> bool (33200.0) -
拡張ライブラリ版を使用している場合に真を返します。 そうでない場合は偽を返します。
拡張ライブラリ版を使用している場合に真を返します。
そうでない場合は偽を返します。 -
JSON
. # restore(source , proc = nil , options = {}) -> object (27412.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}......# 3
# {"a"=>1, "b"=>2, "c"=>3}
@param source JSON 形式の文字列を指定します。他には、to_str, to_io, read メソッドを持つオブジェクトも指定可能です。
@param proc Proc オブジェクトを指定します。
@param options オプションをハッシュで... -
JSON
. # generate(object , state = nil) -> String (27360.0) -
与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。
...ジェクトを一行の JSON 形式の文字列に変換して返します。
デフォルトでは、サイズが最小となる JSON 形式の文字列を生成します。
また、循環参照のチェックを行います。JSON::NaN, JSON::Infinity,
JSON::MinusInfinity を生成すること......もありません。
unparse は将来削除される予定です。
@param object JSON 形式の文字列に変換するオブジェクトを指定します。
@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できま......: :indent
インデントに使用する文字列を指定します。デフォルトは空文字列です。
: :space
a string that is put after, a : or , delimiter (default: '')
: :space_before
a string that is put before a : pair delimiter (default: '')
: :object_nl
a string that is put... -
JSON
. # unparse(object , state = nil) -> String (27360.0) -
与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。
...ジェクトを一行の JSON 形式の文字列に変換して返します。
デフォルトでは、サイズが最小となる JSON 形式の文字列を生成します。
また、循環参照のチェックを行います。JSON::NaN, JSON::Infinity,
JSON::MinusInfinity を生成すること......もありません。
unparse は将来削除される予定です。
@param object JSON 形式の文字列に変換するオブジェクトを指定します。
@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できま......: :indent
インデントに使用する文字列を指定します。デフォルトは空文字列です。
: :space
a string that is put after, a : or , delimiter (default: '')
: :space_before
a string that is put before a : pair delimiter (default: '')
: :object_nl
a string that is put... -
JSON
. # parse!(source , options = {}) -> object (27312.0) -
与えられた JSON 形式の文字列を Ruby オブジェクトに変換して返します。
...えられた JSON 形式の文字列を Ruby オブジェクトに変換して返します。
JSON.#parse よりも危険なデフォルト値が指定されているので
信頼できる文字列のみを入力として使用するようにしてください。
@param source JSON 形式の文字......列を指定します。
@param options オプションをハッシュで指定します。
指定可能なオプションは以下の通りです。
: :max_nesting
入れ子になっているデータの最大の深さを指定します。
数値を指定すると深さのチェック......定すると 4627 を無視してパース時に JSON::NaN, JSON::Infinity,
JSON::MinusInfinity を許可するようになります。デフォルトは真です。
: :create_additions
偽を指定するとマッチするクラスや JSON.create_id が見つかっても付加情報を生成し... -
JSON
. # parse(source , options = {}) -> object (27270.0) -
与えられた JSON 形式の文字列を Ruby オブジェクトに変換して返します。
...れた JSON 形式の文字列を Ruby オブジェクトに変換して返します。
@param source JSON 形式の文字列を指定します。
@param options オプションをハッシュで指定します。
指定可能なオプションは以下の通りです。
: :max_nesting......定すると 4627 を無視してパース時に JSON::NaN, JSON::Infinity,
JSON::MinusInfinity を許可するようになります。デフォルトは偽です。
: :create_additions
偽を指定するとマッチするクラスや JSON.create_id が見つかっても付加情報を生成し......。
: :symbolize_names
真を指定するとハッシュのキーを文字列ではなくシンボルにします。デフォルトは偽です。
//emlist[例][ruby]{
require "json"
JSON.parse('[1,2,{"name":"tanaka","age":19}]')
# => [1, 2, {"name"=>"tanaka", "age"=>19}]
JSON.parse('[1,2,{"nam... -
JSON
. # pretty _ generate(object , options = nil) -> String (27270.0) -
Ruby のオブジェクトを JSON 形式の文字列に変換して返します。
...
Ruby のオブジェクトを JSON 形式の文字列に変換して返します。
このメソッドは JSON.#generate よりも人間に読みやすい文字列を返します。
pretty_unparse は将来削除される予定です。
@param object JSON 形式の文字列に変換するオブ......param options JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを使用する場合指定可能なオプションは JSON.#generate を参照してください。
//emlist[例][ruby]{
require "json"......"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...