869件ヒット
[1-100件を表示]
(0.139秒)
種類
- インスタンスメソッド (495)
- 特異メソッド (231)
- モジュール関数 (121)
- 定数 (22)
クラス
- BigDecimal (22)
- Class (11)
- Complex (22)
- Date (22)
- DateTime (22)
- Exception (22)
-
JSON
:: Parser (33) -
JSON
:: State (231) - OpenStruct (22)
- Range (22)
- Rational (11)
- Regexp (22)
- Struct (11)
- Symbol (11)
- Time (22)
モジュール
- JSON (198)
-
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)
キーワード
- JSON (11)
-
JSON
_ LOADED (11) - VERSION (11)
- [] (22)
-
allow
_ nan? (11) -
array
_ nl (11) -
ascii
_ only? (11) -
buffer
_ initial _ length (11) -
check
_ circular? (11) - configure (11)
-
create
_ id (11) - depth (11)
- dump (11)
-
fast
_ generate (11) -
fast
_ unparse (11) -
from
_ state (11) - generate (22)
- generator (11)
- indent (11)
- j (11)
- jj (11)
-
json
_ creatable? (11) -
json
_ create (143) - load (11)
-
max
_ nesting (11) - merge (11)
- new (22)
-
object
_ nl (11) - parse (22)
- parse! (11)
- parser (11)
-
pretty
_ generate (11) -
pretty
_ unparse (11) -
quirks
_ mode (11) -
quirks
_ mode? (11) - restore (11)
- source (11)
- space (11)
-
space
_ before (11) - state (11)
-
to
_ h (11) -
to
_ hash (11) -
to
_ json (198) -
to
_ json _ raw (11) -
to
_ json _ raw _ object (11) - unparse (11)
検索結果
先頭5件
-
JSON
:: Generator :: GeneratorMethods :: String :: Extend . json _ create(hash) -> String (12202.0) -
JSON のオブジェクトから Ruby の文字列を生成して返します。
...
JSON のオブジェクトから Ruby の文字列を生成して返します。
@param hash キーとして "raw" という文字列を持ち、その値として数値の配列を持つハッシュを指定します。
require 'json'
String.json_create({"raw" => [0x41, 0x42, 0x43]}) # => "A... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw _ object -> Hash (9220.0) -
生の文字列を格納したハッシュを生成します。
...TF-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::GeneratorError)... -
JSON
. generator -> JSON :: Ext :: Generator (6302.0) -
JSON ライブラリがジェネレータとして使用するモジュールを返します。
...
JSON ライブラリがジェネレータとして使用するモジュールを返します。... -
JSON
. parser -> JSON :: Ext :: Parser (6302.0) -
JSON ライブラリがパーサとして使用するクラスを返します。
...
JSON ライブラリがパーサとして使用するクラスを返します。
//emlist[例][ruby]{
require "json"
JSON.parser # => JSON::Ext::Parser
//}... -
JSON
. state -> JSON :: Ext :: Generator :: State (6302.0) -
JSON ライブラリがジェネレータの状態を表すクラスとして使用するクラスを返します。
...
JSON ライブラリがジェネレータの状態を表すクラスとして使用するクラスを返します。
//emlist[例][ruby]{
require "json"
JSON.state # => JSON::Ext::Generator::State
//}... -
JSON
:: State # buffer _ initial _ length -> Integer (6302.0) -
This integer returns the current initial length of the buffer.
...This integer returns the current initial length of the buffer.... -
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]{
require "json"
puts "test".to_json # => "test"
puts '"'.to_json #......=> "\""
puts "\\".to_json # => "\\"
puts "𤘩宮城".to_json(ascii_only: true) # => "\ud851\ude29\u5bae\u57ce"
//}... -
JSON
:: State # check _ circular? -> bool (6214.0) -
循環参照のチェックを行う場合は、真を返します。 そうでない場合は偽を返します。
.../emlist[例 ネストをチェックするケース][ruby]{
require "json"
a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s = JSON.state.......new
begin
JSON.generate(a, s)
rescue JSON::NestingError => e
[e, s.max_nesting, s.check_circular?] # => [#<JSON::NestingError: nesting of 100 is too deep>, 100, true]
end
//}
//emlist[例 ネストをチェックしないケース][ruby]{
require "json"
a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[......]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s2 = JSON.state.new(max_nesting: 0)
json = JSON.generate(a, s2)
[json, s2.max_nesting, s2.check_circular?] # => ["[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[... -
JSON
. create _ id -> String (6208.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
:: Parser . new(source , options => {}) -> JSON :: Parser (6208.0) -
パーサを初期化します。
...。
: :max_nesting
データ構造のネストの深さの最大値を指定します。デフォルトは 19 です。
チェックを無効にするにはゼロまたは偽を指定してください。
: :allow_nan
真を指定すると 4627 を無視して NaN, Infinity, -Infinity をパ......:create_additions
偽を指定するとマッチするクラスや ID があっても付加情報を生成しません。デフォルトは真です。
: :object_class
JSON のオブジェクトを変換するクラスを指定します。デフォルトは Hash です。
: :array_class
JSON......urce パーサの元となる文字列を指定します。
@param options オプションを指定するためのハッシュです。
//emlist[例][ruby]{
require 'json'
parser = JSON::Parser.new(DATA.read)
print parser.source
# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":...