Skip to content

TJSONObject

Class of TJSONObject.

Declaration

Source position: fpjson.pp line 634

type

  TJSONObject = class(TJSONData)
  public
    constructor Create;
    constructor Create(const Elements: Array of const); overload;
    destructor Destroy;
    class function JSONType : TJSONtype;
    class property UnquotedMemberNames: Boolean; {rw}
    function Clone : TJSONData;
    function GetEnumerator : TBaseJSONEnumerator;
    procedure Iterate;
    function IndexOf : Integer;
    function IndexOfName : Integer;
    function Find(const AName: TJSONStringType) : TJSONData; overload;
    function Find(const AName: TJSONStringType; AType: TJSONtype)
              : TJSONData; overload;
    function Find(const key: TJSONStringType; out AValue: TJSONData)
              : Boolean;
    function Find(const key: TJSONStringType; out AValue: TJSONObject)
              : Boolean;
    function Find(const key: TJSONStringType; out AValue: TJSONArray)
              : Boolean;
    function Find(const key: TJSONStringType; out AValue: TJSONString)
              : Boolean;
    function Find(const key: TJSONStringType; out AValue: TJSONBoolean)
              : Boolean;
    function Find(const key: TJSONStringType; out AValue: TJSONNumber)
              : Boolean;
    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;
    procedure Clear;
    function Add(const AName: TJSONStringType; AValue: TJSONData) : Integer; overload;
    function Add(const AName: TJSONStringType; AValue: Boolean) : Integer; overload;
    function Add(const AName: TJSONStringType; AValue: TJSONFloat) : Integer; overload;
    function Add(const AName: TJSONStringType; 
            const AValue: TJSONStringType) : Integer; overload;
    function Add(const AName: string; AValue: TJSONUnicodeStringType)
             : Integer; overload;
    function Add(const AName: TJSONStringType; Avalue: Int64) : Integer; overload;
    function Add(const AName: TJSONStringType; Avalue: QWord) : Integer; overload;
    function Add(const AName: TJSONStringType; Avalue: Integer) : Integer; overload;
    function Add(const AName: TJSONStringType) : Integer; overload;
    function Add(const AName: TJSONStringType; AValue: TJSONArray) : Integer; overload;
    procedure Delete(Index: Integer);
    procedure Delete(const AName: string);
    procedure Remove;
    function Extract(Index: Integer) : TJSONData;
    function Extract(const AName: string) : TJSONData;
    property Names[Index : Integer]: TJSONStringType; {r}
    property Elements[AName : string]: TJSONData; {rw}
    property Types[AName : string]: TJSONtype; {r}
    property Nulls[AName : string]: Boolean; {rw}
    property Floats[AName : string]: TJSONFloat; {rw}
    property Integers[AName : string]: Integer; {rw}
    property Int64s[AName : string]: Int64; {rw}
    property QWords[AName : string]: QWord; {rw}
    property LargeInts[AName : string]: TJSONLargeInt; {rw}
    property UnicodeStrings[AName : string]: TJSONUnicodeStringType; {rw}
    property Strings[AName : string]: TJSONStringType; {rw}
    property Booleans[AName : string]: Boolean; {rw}
    property Arrays[AName : string]: TJSONArray; {rw}
    property Objects[AName : string]: TJSONObject; {rw}
  end;

Description

TJSONObjectClass is the class type of TJSONObject. It is used in the factory methods.

Properties

Member Visibility Description
Arrays public Named access to JSON array values.
Booleans public Named access to boolean values.
Elements public Name-based access to JSON values in the object.
Floats public Named access to float values.
Int64s public Named access to int64 values.
Integers public Named access to integer values.
LargeInts public Get or set elements as LargeInt values.
Names read only public Indexed access to the names of elements.
Nulls public Named access to null values.
Objects public Named access to JSON object values.
QWords public Named access to QWord values.
Strings public Named access to string values.
Types read only public Types of values in the object.
UnicodeStrings public Named access to Unicode string values.
UnquotedMemberNames public Should member names be written unquoted or quoted in JSON.
See all Properties

Methods

Member Visibility Description
Add public Add a name, value to the object.
Clear public Clear the object.
Clone public Clone the JSON object.
Create public Create a new instance of JSON object data.
Delete public Delete an element from the list by index.
Destroy public Free the JSON object.
Extract public Extract an element from the object.
Find public Find an element by name.
Get public Retrieve a value by name.
GetEnumerator public Get an object enumerator.
IndexOf public Return index of JSONData instance in object.
IndexOfName public Return index of name in item list.
Iterate public Iterate over all elements in the object.
JSONType public native JSON data type.
Remove public Remove item by instance.
See all Methods

See also

Name Description
TJSONObject Class of TJSONObject.
SetJSONInstanceType JSON factory: Set the JSONData class types to use.
GetJSONInstanceType JSON factory: Get the JSONData class types to use.