System.JSON.Readers.TJsonReader.MaxDepth

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

property MaxDepth: Integer read FMaxDepth write FMaxDepth;

C++

__property int MaxDepth = {read=FMaxDepth, write=FMaxDepth, nodefault};

プロパティ

種類 可視性 ソース ユニット
property public
System.JSON.Readers.pas
System.JSON.Readers.hpp
System.JSON.Readers TJsonReader


説明

JSON を読み込む際に可能な入れ子レベルの最大Depth を、取得または設定します。

過去の MaxDepth 制限を読み込むと、EJsonReaderException 例外が発生します。

The <reader_name>'s MaxDeepth of <MaxDepth_value> has been exceeded. Path <path_to_token>, line <line_number>, position <position_number_inside_line>.

MaxDepth の負の値は、Depth 制限がないことを意味します。デフォルト値は -1 です。

例:

'{"Transaction":[' 
  '{"id":662713, "firstName":"John", "lastName":"Doe", "price": 2.1, "parent_id": null, validated:true, "items":[{"id":001,"ItemName":"Cup"},{"id":002,"ItemName":"Sticker"}]},'
  '{"id":662714, "firstName":"Anna", "lastName":"Smith", "price": 4.5, "parent_id": null, validated: false},' 
  '{"id":662715, "firstName":"Peter", "lastName":"Jones", "price": 3.6, "parent_id": null, validated: true}' 
  ']}'

MaxDepth3 に設定すると、リーダーは 項目に到達した時点で例外を発生させます:

The reader's MaxDeepth of 3 has been exceeded. Path Transaction[0].items, line 2, position 112.

関連項目