TROJSONProperty

Overview

The TROJSONProperty class represents a JSON named value i.e. a name-value pair. It is implemented as a value class (TROJSONValue) extension, see the ancestor's documentation for more information.
Users are not required to deal with JSON directly, so they usually don't need to use this class.

Location

 

constructor Create (TCollection)  overload override    (declared in TROJSONValue)

Creates a new object instance and specifies the owning collection for it.

constructor Create(Collection: TCollection)

Parameters:


constructor Create (TROJSONDataType)  reintroduce overload    (declared in TROJSONValue)

Creates a new object instance and specifies the data type to store in it.

constructor Create(aType: TROJSONDataType)

Parameters:


AsArray    (declared in TROJSONValue)

Reads and writes the value as JSON array.

property AsArray: TROJSONArray read write

AsBoolean    (declared in TROJSONValue)

Reads and writes the value as boolean.

property AsBoolean: Boolean read write

AsNumber    (declared in TROJSONValue)

Reads and writes the value as number. The Variant data type is used to store the number.

property AsNumber: Variant read write

AsObject    (declared in TROJSONValue)

Reads and writes the value as a JSON object.

property AsObject: TROJSONObject read write

AsString    (declared in TROJSONValue)

Reads and writes the value as string.

property AsString: JSON_String read write

Clear    (declared in TROJSONValue)

Empties the object. It will contain the value equivalent to NULL after this call.

procedure Clear

LoadFromStream    (declared in TROJSONValue)

Deserializes the object from the stream.

procedure LoadFromStream(AStream: TStream; AUTF8Stream: boolean)

Parameters:

  • AStream: Source stream
  • AUTF8Stream: When set to true, the object will use UTF-8 encoding when deserializing the data.

LoadValueFromStream

procedure LoadValueFromStream(AStream: TStream; AUTF8Stream: boolean)

Parameters:

  • AStream:
  • AUTF8Stream:

Name

Stores the name part of the name-value pair.

property Name: JSON_String read write

SaveToStream    (declared in TROJSONValue)

Serializes the object to the stream.

procedure SaveToStream(AStream: TStream; AUTF8Stream: boolean)

Parameters:

  • AStream: Target stream
  • AUTF8Stream: When set to true, the object will use UTF-8 encoding when serializing the data.

SaveValueToStream

procedure SaveValueToStream(AStream: TStream; AUTF8Stream: boolean)

Parameters:

  • AStream:
  • AUTF8Stream:

SetAsNull    (declared in TROJSONValue)

Sets the NULL value to the object, this is equivalent to the Clear call.

procedure SetAsNull

ValueType    (declared in TROJSONValue)

Allows to get the data type (TROJSONDataType value) that is currently stored in the object.

property ValueType: TROJSONDataType read write

VarValue    (declared in TROJSONValue)

Reads and writes the value as a Variant.

property VarValue: Variant read write

 

AsArray    (declared in TROJSONValue)

Reads and writes the value as JSON array.

property AsArray: TROJSONArray read write

AsBoolean    (declared in TROJSONValue)

Reads and writes the value as boolean.

property AsBoolean: Boolean read write

AsNumber    (declared in TROJSONValue)

Reads and writes the value as number. The Variant data type is used to store the number.

property AsNumber: Variant read write

AsObject    (declared in TROJSONValue)

Reads and writes the value as a JSON object.

property AsObject: TROJSONObject read write

AsString    (declared in TROJSONValue)

Reads and writes the value as string.

property AsString: JSON_String read write

Name

Stores the name part of the name-value pair.

property Name: JSON_String read write

ValueType    (declared in TROJSONValue)

Allows to get the data type (TROJSONDataType value) that is currently stored in the object.

property ValueType: TROJSONDataType read write

VarValue    (declared in TROJSONValue)

Reads and writes the value as a Variant.

property VarValue: Variant read write

 

constructor Create (TCollection)  overload override    (declared in TROJSONValue)

Creates a new object instance and specifies the owning collection for it.

constructor Create(Collection: TCollection)

Parameters:


constructor Create (TROJSONDataType)  reintroduce overload    (declared in TROJSONValue)

Creates a new object instance and specifies the data type to store in it.

constructor Create(aType: TROJSONDataType)

Parameters:


Clear    (declared in TROJSONValue)

Empties the object. It will contain the value equivalent to NULL after this call.

procedure Clear

LoadFromStream    (declared in TROJSONValue)

Deserializes the object from the stream.

procedure LoadFromStream(AStream: TStream; AUTF8Stream: boolean)

Parameters:

  • AStream: Source stream
  • AUTF8Stream: When set to true, the object will use UTF-8 encoding when deserializing the data.

LoadValueFromStream

procedure LoadValueFromStream(AStream: TStream; AUTF8Stream: boolean)

Parameters:

  • AStream:
  • AUTF8Stream:

SaveToStream    (declared in TROJSONValue)

Serializes the object to the stream.

procedure SaveToStream(AStream: TStream; AUTF8Stream: boolean)

Parameters:

  • AStream: Target stream
  • AUTF8Stream: When set to true, the object will use UTF-8 encoding when serializing the data.

SaveValueToStream

procedure SaveValueToStream(AStream: TStream; AUTF8Stream: boolean)

Parameters:

  • AStream:
  • AUTF8Stream:

SetAsNull    (declared in TROJSONValue)

Sets the NULL value to the object, this is equivalent to the Clear call.

procedure SetAsNull