Sign in Join
FPDoc Onlineexperiment

TJSONObject.Get function

Member of TJSONObjectpublicIn unit fpJson

Retrieve a value by name.

Declaration

pascal
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

Arguments

AName

Name of the value to retrieve.

ADefault

Default value to return if no value is found or it has the wrong type.

Function result

The requested value.

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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.