TROJSONArray

Overview

The TROJSONArray class is created to represent a JSON array - an ordered collection of values. This class is used internally by the JSON (de)serializer inside the TROJSONMessage class.
Users are not required to deal with JSON directly, so they usually don't need to use this class.

Location

  • Unit: uROJSONParser.pas
  • Ancestry: TCollection | TROJSONArray

 

constructor Create

Creates the array object.

constructor Create

Add

Adds a new empty value to the array and returns the created item for further modification.

function Add: TROJSONValue

AddArrayValue

Adds a new array (TROJSONArray class) value to the array and returns the created item for further modification.

function AddArrayValue: TROJSONValue

AddBooleanValue

Internal method overridden to serialize the object to the stream.

function AddBooleanValue(const aValue: Boolean): TROJSONValue

Parameters:

  • aValue: Value to add, the variant value must be convertible to string

AddNullValue

Adds a new Null value to the array and returns the created item for further modification.

function AddNullValue: TROJSONValue

AddNumberValue

Internal method overridden to serialize the object to the stream.

function AddNumberValue(const aValue: Variant): TROJSONValue

Parameters:

  • aValue: Value to add, the variant value must be convertible to string

AddObject

Adds a new object (TROJSONObject class) value to the array and returns the created item for further modification.

function AddObject: TROJSONValue

AddStringValue

Internal method overridden to serialize the object to the stream.

function AddStringValue(const aValue: JSON_String): TROJSONValue

Parameters:

  • aValue: Value to add, the variant value must be convertible to string

AddVariantValue

Internal method overridden to serialize the object to the stream.

function AddVariantValue(const aValue: Variant): TROJSONValue

Parameters:

  • aValue: Value to add, the variant value must be convertible to string

FindObjectByStringValue

Internal method overridden to serialize the object to the stream.

function FindObjectByStringValue(const aName: JSON_String; const aValue: JSON_String): TROJSONObject

Parameters:

  • aName: Target stream.
  • aValue: If set to true, the data is written using UTF-8 encoding

IntLoadFromStream  protected

Internal method overridden to serialize the object to the stream.

procedure IntLoadFromStream(aStream: TStream)

Parameters:

  • aStream: Value to add, the variant value must be convertible to string

IntSaveToStream  protected

Internal method overridden to serialize the object to the stream.

procedure IntSaveToStream(aStream: TStream)

Parameters:

  • aStream: Value to add, the variant value must be convertible to string

Items

Provides acceess to the array items by index.

property Items[Index: Integer]: TROJSONValue read write

LoadFromStream

Internal method overridden to serialize the object to the stream.

procedure LoadFromStream(aStream: TStream; AUTF8Stream: Boolean)

Parameters:

  • aStream: Target stream.
  • AUTF8Stream: If set to true, the data is written using UTF-8 encoding

SaveToStream

Internal method overridden to serialize the object to the stream.

procedure SaveToStream(aStream: TStream; AUTF8Stream: Boolean)

Parameters:

  • aStream: Target stream.
  • AUTF8Stream: If set to true, the data is written using UTF-8 encoding

 

Items

Provides acceess to the array items by index.

property Items[Index: Integer]: TROJSONValue read write

 

constructor Create

Creates the array object.

constructor Create

Add

Adds a new empty value to the array and returns the created item for further modification.

function Add: TROJSONValue

AddArrayValue

Adds a new array (TROJSONArray class) value to the array and returns the created item for further modification.

function AddArrayValue: TROJSONValue

AddBooleanValue

Internal method overridden to serialize the object to the stream.

function AddBooleanValue(const aValue: Boolean): TROJSONValue

Parameters:

  • aValue: Value to add, the variant value must be convertible to string

AddNullValue

Adds a new Null value to the array and returns the created item for further modification.

function AddNullValue: TROJSONValue

AddNumberValue

Internal method overridden to serialize the object to the stream.

function AddNumberValue(const aValue: Variant): TROJSONValue

Parameters:

  • aValue: Value to add, the variant value must be convertible to string

AddObject

Adds a new object (TROJSONObject class) value to the array and returns the created item for further modification.

function AddObject: TROJSONValue

AddStringValue

Internal method overridden to serialize the object to the stream.

function AddStringValue(const aValue: JSON_String): TROJSONValue

Parameters:

  • aValue: Value to add, the variant value must be convertible to string

AddVariantValue

Internal method overridden to serialize the object to the stream.

function AddVariantValue(const aValue: Variant): TROJSONValue

Parameters:

  • aValue: Value to add, the variant value must be convertible to string

FindObjectByStringValue

Internal method overridden to serialize the object to the stream.

function FindObjectByStringValue(const aName: JSON_String; const aValue: JSON_String): TROJSONObject

Parameters:

  • aName: Target stream.
  • aValue: If set to true, the data is written using UTF-8 encoding

IntLoadFromStream  protected

Internal method overridden to serialize the object to the stream.

procedure IntLoadFromStream(aStream: TStream)

Parameters:

  • aStream: Value to add, the variant value must be convertible to string

IntSaveToStream  protected

Internal method overridden to serialize the object to the stream.

procedure IntSaveToStream(aStream: TStream)

Parameters:

  • aStream: Value to add, the variant value must be convertible to string

LoadFromStream

Internal method overridden to serialize the object to the stream.

procedure LoadFromStream(aStream: TStream; AUTF8Stream: Boolean)

Parameters:

  • aStream: Target stream.
  • AUTF8Stream: If set to true, the data is written using UTF-8 encoding

SaveToStream

Internal method overridden to serialize the object to the stream.

procedure SaveToStream(aStream: TStream; AUTF8Stream: Boolean)

Parameters:

  • aStream: Target stream.
  • AUTF8Stream: If set to true, the data is written using UTF-8 encoding