System.JSON.TJSONValue.TryGetValue
Delphi
function TryGetValue<T>(out AValue: T): Boolean; overload;
function TryGetValue<T>(const APath: string; out AValue: T): Boolean; overload;
C++
template<typename T> bool __fastcall TryGetValue(/* out */ T &AValue)/* overload */;
template<typename T> bool __fastcall TryGetValue(const System::UnicodeString APath, /* out */ T &AValue)/* overload */;
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | System.JSON.pas System.JSON.hpp |
System.JSON | TJSONValue |
説明
指定された JSON パス APath
にある TJSONValue オブジェクトを探し、この JSON 値を T
JSON 型にキャストし、結果の JSON 値を AValue
に設定します。成功すれば True
を、成功しなければ False
を返します。
現在のバージョンの TJSONValue では、以下の機能を実装しています。
- 指定された
APath
が空であるか、そもそも指定されていない場合、TryGetValue はこの TJSONValue インスタンスをT
型にキャストし、結果の JSON 値をAValue
に設定します。TryGetValue は、T
へのキャストが成功するとTrue
を返します。 - 空ではない
APath
が指定されると、TryGetValue はFalse
を返します。AValue
には何も設定されません。