Skip to content

TJSONDataWriter

JSON writer that builds TJSONData tree in memory

Declaration

Source position: jsonwriter.pp line 70

type

  TJSONDataWriter = class(TAbstractJSONWriter)
  public
    destructor destroy;
    procedure EndArray;
    procedure EndObject;
    procedure EndProperty;
    procedure NextElement;
    procedure StartArray;
    procedure StartObject;
    procedure StartProperty;
    procedure WriteValue(aValue: Boolean);
    procedure WriteValue(aValue: Double);
    procedure WriteValue(aValue: Int64);
    procedure WriteValue(aValue: Integer);
    procedure WriteValue(const aValue: string);
    procedure WriteValue;
    procedure Flush;
    function ExtractData : TJSONData;
  end;

Description

TJSONDataWriter is a JSON writer implementation that builds a TJSONData tree in memory. This writer maintains an internal stack of JSON objects and arrays and constructs the complete JSON data structure as it writes. The resulting TJSONData can be extracted using ExtractData.

Methods

Member Visibility Description
destroy public Destroy the writer and free any created JSON data
EndArray public End writing a JSON array
EndObject public End writing a JSON object
EndProperty public End writing a property in a JSON object
ExtractData public Extract the created JSON data tree
Flush public Validate the internal state for data extraction
NextElement public Prepare for the next element in a JSON array
StartArray public Start writing a JSON array
StartObject public Start writing a JSON object
StartProperty public Start writing a property in a JSON object
WriteValue public Write a JSON value to the current position
See all Methods

See also

Name Description
TAbstractJSONWriter Abstract base class for JSON writers
TJSONStreamWriter JSON writer that writes directly to a stream
ExtractData Extract the created JSON data tree
TJSONData Base (abstract) object for all JSON based data types.