Skip to content

TJSONStreamWriter

JSON writer that writes directly to a stream

Declaration

Source position: jsonwriter.pp line 102

type

  TJSONStreamWriter = class(TAbstractJSONWriter)
  public
    constructor create;
    procedure WriteValue;
    procedure WriteValue(aValue: Boolean);
    procedure WriteValue(aValue: Integer);
    procedure WriteValue(aValue: Int64);
    procedure WriteValue(aValue: Double);
    procedure WriteValue(const aValue: string);
    procedure StartProperty;
    procedure EndProperty;
    procedure StartArray;
    procedure EndArray;
    procedure NextElement;
    procedure StartObject;
    procedure EndObject;
    procedure Flush;
    property StrictStrings: Boolean; {rw}
  end;

Description

TJSONStreamWriter is a JSON writer implementation that writes JSON text directly to a stream without building an in-memory data structure. This writer is memory-efficient for large JSON files as it streams the output directly. It maintains element counters to properly format arrays and objects with correct comma placement.

Properties

Member Visibility Description
StrictStrings public Control strict JSON string encoding
See all Properties

Methods

Member Visibility Description
create public Create a new stream writer for the given stream
EndArray public End writing a JSON array
EndObject public End writing a JSON object
EndProperty public End writing a property in a JSON object
Flush public Flush any pending output to the stream
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 directly to the stream
See all Methods

See also

Name Description
TAbstractJSONWriter Abstract base class for JSON writers
TJSONDataWriter JSON writer that builds TJSONData tree in memory
StrictStrings Control strict JSON string encoding
TStream