448件ヒット
[1-100件を表示]
(0.035秒)
種類
- インスタンスメソッド (330)
- 特異メソッド (55)
- 文書 (30)
- モジュール関数 (22)
- ライブラリ (11)
ライブラリ
- json (374)
-
json
/ add / ostruct (11) -
json
/ add / struct (11) -
rdoc
/ generator / json _ index (11)
クラス
-
JSON
:: Parser (33) -
JSON
:: State (209) - OpenStruct (11)
-
RDoc
:: Generator :: JsonIndex (11) - Struct (11)
モジュール
- JSON (33)
-
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 (11) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (11)
キーワード
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) -
allow
_ nan? (11) -
array
_ nl (11) -
array
_ nl= (11) -
check
_ circular? (11) - configure (11)
-
create
_ id (11) - generate (11)
- indent (11)
- indent= (11)
-
json
_ create (11) -
max
_ nesting (11) -
max
_ nesting= (11) - merge (11)
-
object
_ nl (11) -
object
_ nl= (11) - parse (11)
-
rdoc
/ generator / json _ index (11) - source (11)
- space (11)
- space= (11)
-
space
_ before (11) -
space
_ before= (11) -
to
_ h (11) -
to
_ hash (11) -
to
_ json (110) - unparse (11)
検索結果
先頭5件
-
JSON
:: State . new(options = {}) -> JSON :: State (21346.0) -
自身を初期化します。
...字列を指定します。デフォルトは空文字列です。
: :space
JSON 形式の文字列のトークン間に挿入する文字列を指定します。デフォルトは空文字列です。
: :space_before
JSON 形式の文字列中で JavaScript のオブジェクトを表す部分......。デフォルトは空文字列です。
: :object_nl
JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を指定します。
デフォルトは空文字列です。
: :array_nl
JSON 形式の文字列中に現れる JavaScript の配列......いて JSON 形式の文字列を生成します。
デフォルトは偽です。
: :buffer_initial_length
sets the initial length of the generator's internal buffer.
//emlist[例 Hash を指定][ruby]{
require "json"
json_state = JSON::State.new(indent: "\t")
json_state.class # => JSON::Ext... -
JSON
:: Parser . new(source , options => {}) -> JSON :: Parser (21250.0) -
パーサを初期化します。
...も付加情報を生成しません。デフォルトは真です。
: :object_class
JSON のオブジェクトを変換するクラスを指定します。デフォルトは Hash です。
: :array_class
JSON の配列を変換するクラスを指定します。デフォルトは Array です......列を指定します。
@param options オプションを指定するためのハッシュです。
//emlist[例][ruby]{
require 'json'
parser = JSON::Parser.new(DATA.read)
print parser.source
# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# =......":25
}
}
//}
//emlist[例 object_class を指定する][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 # =>... -
RDoc
:: Generator :: JsonIndex . new(parent _ generator , options) -> RDoc :: Generator :: JsonIndex (21201.0) -
RDoc::Generator::JsonIndex オブジェクトを初期化します。
...RDoc::Generator::JsonIndex オブジェクトを初期化します。
@param parent_generator 親となるジェネレータオブジェクトを指定します。
RDoc::Generator::JsonIndex#class_dir や
#file_dir を決めるのに使用します... -
JSON
. # generate(object , state = nil) -> String (21166.0) -
与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。
...オブジェクトを一行の JSON 形式の文字列に変換して返します。
デフォルトでは、サイズが最小となる JSON 形式の文字列を生成します。
また、循環参照のチェックを行います。JSON::NaN, JSON::Infinity,
JSON::MinusInfinity を生成する......こともありません。
unparse は将来削除される予定です。
@param object JSON 形式の文字列に変換するオブジェクトを指定します。
@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定で......ise JSON::CircularDatastructure 与えられたオブジェクトが循環参照を持つ場合に発生します。
//emlist[例][ruby]{
require "json"
JSON.generate([1, 2, { name: "tanaka", age: 19 }])
# => "[1,2,{\"name\":\"tanaka\",\"age\":19}]"
json_state = JSON::State.new(space: " ")
JSON.ge... -
JSON
. # unparse(object , state = nil) -> String (21166.0) -
与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。
...オブジェクトを一行の JSON 形式の文字列に変換して返します。
デフォルトでは、サイズが最小となる JSON 形式の文字列を生成します。
また、循環参照のチェックを行います。JSON::NaN, JSON::Infinity,
JSON::MinusInfinity を生成する......こともありません。
unparse は将来削除される予定です。
@param object JSON 形式の文字列に変換するオブジェクトを指定します。
@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定で......ise JSON::CircularDatastructure 与えられたオブジェクトが循環参照を持つ場合に発生します。
//emlist[例][ruby]{
require "json"
JSON.generate([1, 2, { name: "tanaka", age: 19 }])
# => "[1,2,{\"name\":\"tanaka\",\"age\":19}]"
json_state = JSON::State.new(space: " ")
JSON.ge... -
JSON
. create _ id -> String (21112.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(......object)
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,\"name\":\"tanaka\"}"
JSON.parse(json, create_additions: true)
# => #<User:0x0000557709b269e0 @id=1, @name="tanaka">
//}... -
JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (9177.0) -
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
...した結果を JSON 形式の文字列に変換して返します。
このメソッドはあるオブジェクトに to_json メソッドが定義されていない場合に使用する
フォールバックのためのメソッドです。
@param state_or_hash 生成する JSON 形式の文字......をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
class Person
attr :name, :age
def initialize(name, ag......e)
@name, @age = name, age
end
end
tanaka = Person.new("tanaka", 29)
tanaka.to_json # => "\"#<Person:0x00007ffdec0167c8>\""
tanaka.method(:to_json).owner # => JSON::Ext::Generator::GeneratorMethods::Object
//}... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json(state _ or _ hash = nil) -> String (9171.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"
//}... -
JSON
:: Generator :: GeneratorMethods :: Array # to _ json(state _ or _ hash = nil) -> String (9153.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 (9153.0) -
自身から生成した JSON 形式の文字列を返します。
...成した JSON 形式の文字列を返します。
"false" という文字列を返します。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引......数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
false.to_json # => "false"
//}...