405件ヒット
[1-100件を表示]
(0.041秒)
クラス
-
JSON
:: Parser (22) -
JSON
:: State (77) - Object (26)
モジュール
- JSON (143)
-
JSON
:: Generator :: GeneratorMethods :: Object (11) -
JSON
:: Generator :: GeneratorMethods :: String (22) - Kernel (33)
キーワード
- JSON (22)
-
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) - [] (22)
-
create
_ id (11) - dump (11)
-
fast
_ generate (11) -
fast
_ unparse (11) - generate (22)
- j (11)
- jj (11)
- load (11)
- new (22)
-
object
_ nl (11) -
object
_ nl= (11) - parse (22)
- parse! (11)
-
pretty
_ generate (11) -
pretty
_ unparse (11) - restore (11)
- then (12)
-
to
_ h (11) -
to
_ hash (11) -
to
_ json (11) -
to
_ json _ raw (11) -
to
_ json _ raw _ object (11) - unparse (11)
-
yield
_ self (14)
検索結果
先頭5件
-
json (38114.0)
-
JSON (JavaScript Object Notation)を扱うライブラリです。
...JSON (JavaScript Object Notation)を扱うライブラリです。
このライブラリでは、JSON モジュールに JSON を操作するための代表的なメソッドが集められています。
詳細は JSON モジュールを参照してください。
JSON の仕様は 7159 を参照......][ruby]{
require "json"
# JSON文字列をRubyのオブジェクトに変換する
json_str = '{"name": "Ruby", "age": 30}'
JSON.parse(json_str) # => {"name"=>"Ruby", "age"=>30}
# RubyのオブジェクトをJSON文字列に変換する
data = {"name" => "Ruby", "age" => 30}
JSON.dump(data) # => "... -
JSON
:: Ext :: Generator :: GeneratorMethods :: Object (35048.0) -
Alias of JSON::Generator::GeneratorMethods::Object
...Alias of JSON::Generator::GeneratorMethods::Object... -
JSON
:: Generator :: GeneratorMethods :: Object (35048.0) -
Object に JSON で使用するインスタンスメソッドを追加するためのモジュールです。
...Object に JSON で使用するインスタンスメソッドを追加するためのモジュールです。... -
Object
# then {|x| . . . } -> object (30228.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...す。
//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
yield_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}
ブロックなしで呼び出されたときは Enumerator を返します。......例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
Object
# yield _ self {|x| . . . } -> object (30228.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...す。
//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
yield_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}
ブロックなしで呼び出されたときは Enumerator を返します。......例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
Object
# then -> Enumerator (30028.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...す。
//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
yield_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}
ブロックなしで呼び出されたときは Enumerator を返します。......例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
Object
# yield _ self -> Enumerator (30028.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...す。
//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
yield_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}
ブロックなしで呼び出されたときは Enumerator を返します。......例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw _ object -> Hash (29351.0) -
生の文字列を格納したハッシュを生成します。
... 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::Ge... -
JSON
:: State # object _ nl -> String (23332.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::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 # object _ nl=(string) (23332.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)
# => [1,2,{"name":"tanaka","age":19}]
json_state.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
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (23177.0) -
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
...した結果を JSON 形式の文字列に変換して返します。
このメソッドはあるオブジェクトに to_json メソッドが定義されていない場合に使用する
フォールバックのためのメソッドです。
@param state_or_hash 生成する JSON 形式の文字......ruby]{
require "json"
class Person
attr :name, :age
def initialize(name, age)
@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
//}...