Show: Delphi C++
Display Preferences

System.JSON.TJSONValue.GetValue

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function GetValue<T>(const APath: string = ''): T; overload;
function GetValue<T>(const APath: string; ADefaultValue: T): T; overload;

C++

template<typename T> T __fastcall GetValue(const System::UnicodeString APath = System::UnicodeString())/* overload */;
template<typename T> T __fastcall GetValue(const System::UnicodeString APath, T ADefaultValue)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.JSON.pas
System.JSON.hpp
System.JSON TJSONValue

Description

Finds a TJSONValue object located at the specified APath JSON path, casts this JSON value as the T JSON type and returns this value. Otherwise, returns ADefaultValue.

If GetValue unable to find a TJSONValue object located at the specified APath JSON path and GetValue does not specify a ADefaultValue parameter, then GetValue raises an EJSONException exception.

In the current version, TJSONValue implements the following functionality:

  • If the specified APath is empty, GetValue casts this TJSONValue instance as the T type and returns the obtained value.
  • If the APath is specified and it is not empty and the GetValue version has the default ADefaultValue parameter, then GetValue returns the specified ADefaultValue value.
  • If the specified APath is not empty and the GetValue version does not have the default ADefaultValue parameter, GetValue raises an EJSONException exception, printing
    Value '<JSON path>' not found .

See Also

Personal tools
RAD Studio 10.2 Tokyo
In Other Languages
Previous Versions
Assistance