Skip to content

TJSONObject.Get

Retrieve a value by name.

Declaration

Source position: fpjson.pp line 732

public 
function Get(const AName: string) : TJSONVariant;

function Get(const AName: string; ADefault: TJSONFloat) : TJSONFloat;

function Get(const AName: string; ADefault: Integer) : Integer;

function Get(const AName: string; ADefault: Int64) : Int64;

function Get(const AName: string; ADefault: QWord) : QWord;

function Get(const AName: string; ADefault: TJSONUnicodeStringType)
             : TJSONUnicodeStringType;

function Get(const AName: string; ADefault: Boolean) : Boolean;

function Get(const AName: string; ADefault: TJSONStringType)
             : TJSONStringType;

function Get(const AName: string; ADefault: TJSONArray) : TJSONArray;

function Get(const AName: string; ADefault: TJSONObject) : TJSONObject;

Description

Get can be used to retrieve a value by name. If an element with name equal to AName exists, and its type corresponds to the type of the ADefault, then the value is returned. If no element element with the correct type exists, the ADefault value is returned.

If no default is specified, the value is returned as a variant type, or Null if no value was found.

The other value retrieval properties such as Integers, Int64s, Booleans, Strings, Floats, Arrays, and Objects will raise an exception if the name is not found. The Get function does not raise an exception.

See also

Name Description
Integers Named access to integer values.
Int64s Named access to int64 values.
Booleans Named access to boolean values.
Strings Named access to string values.
Floats Named access to float values.
Arrays Named access to JSON array values.
Objects Named access to JSON object values.