るりまサーチ

最速Rubyリファレンスマニュアル検索!
44件ヒット [1-44件を表示] (0.012秒)
トップページ > クエリ:NestingError[x]

別のキーワード

  1. json nestingerror
  2. json json::nestingerror
  3. nestingerror json

ライブラリ

クラス

キーワード

検索結果

JSON::NestingError (18000.0)

パースしようとしているデータ構造のネストが深すぎる場合に発生する例外です。

パースしようとしているデータ構造のネストが深すぎる場合に発生する例外です。

JSON::State#check_circular? -> bool (12.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[例 ネストをチェックしないケース][...

JSON::State#max_nesting -> Integer (6.0)

生成される JSON 形式の文字列のネストの深さの最大値を返します。

...State.new(max_nesting: 2)
json_state.max_nesting # => 2
JSON.generate([[]], json_state)
JSON.generate([[[]]], json_state) # => JSON::NestingError
//}

//emlist[例 ネストの深さチェックを行わない][ruby]{
require "json"

json_state = JSON::State.new(max_nesting: 0)
json_state...

JSON::State#max_nesting=(depth) (6.0)

生成される JSON 形式の文字列のネストの深さの最大値をセットします。

...せん。

//emlist[例][ruby]{
require "json"

json_state = JSON::State.new(max_nesting: 2)
json_state.max_nesting # => 2
JSON.generate([[]], json_state)
json_state.max_nesting = 3
json_state.max_nesting # => 3
JSON.generate([[[[]]]], json_state) # => JSON::NestingError
//}...