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 (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:


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:


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

IntLoadFromStream  protected override

This method is overridden to support the Name serialization.

procedure IntLoadFromStream(aStream: TStream)

Parameters:

  • aStream: Target stream to serialize into

IntSaveToStream  protected override

This method is overridden to support the Name serialization.

procedure IntSaveToStream(aStream: TStream)

Parameters:

  • aStream: Target stream to serialize into

LoadFromStream    (declared in TROJSONValue)

This internal method may be overriden in descendants to implement a specific object serialization to the stream. Called by the SaveFromStream method.

procedure LoadFromStream(aStream: TStream; AUTF8Stream: Boolean)

Parameters:

  • aStream: Target stream
  • AUTF8Stream: When set to true, the object will use UTF-8 encoding when serializing 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)

This internal method may be overriden in descendants to implement a specific object serialization to the stream. Called by the SaveFromStream method.

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 (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:


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:


Clear    (declared in TROJSONValue)

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

procedure Clear

IntLoadFromStream  protected override

This method is overridden to support the Name serialization.

procedure IntLoadFromStream(aStream: TStream)

Parameters:

  • aStream: Target stream to serialize into

IntSaveToStream  protected override

This method is overridden to support the Name serialization.

procedure IntSaveToStream(aStream: TStream)

Parameters:

  • aStream: Target stream to serialize into

LoadFromStream    (declared in TROJSONValue)

This internal method may be overriden in descendants to implement a specific object serialization to the stream. Called by the SaveFromStream method.

procedure LoadFromStream(aStream: TStream; AUTF8Stream: Boolean)

Parameters:

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

LoadValueFromStream

procedure LoadValueFromStream(aStream: TStream; AUTF8Stream: Boolean)

Parameters:

  • aStream:
  • AUTF8Stream:

SaveToStream    (declared in TROJSONValue)

This internal method may be overriden in descendants to implement a specific object serialization to the stream. Called by the SaveFromStream method.

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