るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

検索結果

<< 1 2 3 ... > >>

JSON::Generator::GeneratorMethods::String#to_json_raw_object -> Hash (12220.0)

生の文字列を格納したハッシュを生成します。

...TF-8 の文字列ではなく生の文字列を JSON に変換する場合に使用してください。

r
equire '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::GeneratorError)...

JSON::Generator::GeneratorMethods::String#to_json_raw -> String (12202.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...

Regexp.json_create(hash) -> Regexp (9301.0)

JSON のオブジェクトから Ruby のオブジェクトを生成して返します。

...
JSON
のオブジェクトから Ruby のオブジェクトを生成して返します。

@param hash 適切なキーを持つハッシュを指定します。...

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

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

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

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

//emlist[例][ruby]{
r
equire "json"

[1, 2, 3].to_json # => "[1,2,3]"
//}...

JSON::Generator::GeneratorMethods::String::Extend.json_create(hash) -> String (9202.0)

JSON のオブジェクトから Ruby の文字列を生成して返します。

...
JSON
のオブジェクトから Ruby の文字列を生成して返します。

@param hash キーとして "raw" という文字列を持ち、その値として数値の配列を持つハッシュを指定します。

r
equire 'json'
String.json_create({"raw" => [0x41, 0x42, 0x43]}) # => "A...

絞り込み条件を変える

JSON::Parser#parse -> object (9202.0)

現在のソースをパースして結果を Ruby のオブジェクトとして返します。

... Ruby のオブジェクトとして返します。

//emlist[例][ruby]{
r
equire '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
person.name # => "tanaka"
person.age # => 20

__END__
{
"name":"tanaka",
"age":20
}
//}

@see JSON::Parser#source...

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

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

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

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


r
equire '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}...
..."c"
# 3
# {"a"=>1, "b"=>2, "c"=>3}

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

@param proc Proc オブジェクトを指定します。

@param options オプションをハッシュ...

JSON.generator -> JSON::Ext::Generator (6302.0)

JSON ライブラリがジェネレータとして使用するモジュールを返します。

...
JSON
ライブラリがジェネレータとして使用するモジュールを返します。...

JSON.parser -> JSON::Ext::Parser (6302.0)

JSON ライブラリがパーサとして使用するクラスを返します。

...
JSON
ライブラリがパーサとして使用するクラスを返します。

//emlist[例][ruby]{
r
equire "json"

JSON
.parser # => JSON::Ext::Parser
//}...

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

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

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

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

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

//emlist[例][ruby]{
r
equire "json"

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

絞り込み条件を変える

<< 1 2 3 ... > >>