Skip to content

TJSONEventReader

Event-based JSON reader that fires events for JSON elements

Declaration

Source position: jsonreader.pp line 90

type

  TJSONEventReader = class(TBaseJSONReader)
  public
    procedure Execute;
    property OnNullValue: TNotifyEvent; {rw}
    property OnBooleanValue: TOnJSONBoolean; {rw}
    property OnNumberValue: TOnJSONString; {rw}
    property OnFloatValue: TOnJSONFloat; {rw}
    property OnIntegerValue: TOnJSONInteger; {rw}
    property OnInt64Value: TOnJSONInt64; {rw}
    property OnQWordValue: TOnJSONQWord; {rw}
    property OnStringValue: TOnJSONString; {rw}
    property OnKeyName: TOnJSONKey; {rw}
    property OnStartObject: TNotifyEvent; {rw}
    property OnEndObject: TNotifyEvent; {rw}
    property OnStartArray: TNotifyEvent; {rw}
    property OnEndArray: TNotifyEvent; {rw}
  end;

Description

TJSONEventReader provides event-based JSON reading functionality. It inherits from TBaseJSONReader and fires specific events when different JSON elements are encountered during parsing. This allows applications to process JSON data using an event-driven approach similar to SAX parsing for XML. Each JSON element type has a corresponding event property that can be assigned to handle the parsed data.

Methods

Member Visibility Description
Execute public Starts the JSON parsing process and fires events
See all Methods

Events

Member Visibility Description
OnBooleanValue public Event fired when a JSON boolean value is encountered
OnEndArray public Event fired when a JSON array ends
OnEndObject public Event fired when a JSON object ends
OnFloatValue public Event fired when a JSON floating-point value is encountered
OnInt64Value public Event fired when a JSON 64-bit integer value is encountered
OnIntegerValue public Event fired when a JSON integer value is encountered
OnKeyName public Event fired when a JSON object key name is encountered
OnNullValue public Event fired when a JSON null value is encountered
OnNumberValue public Event fired when a JSON number value is encountered
OnQWordValue public Event fired when a JSON quadword value is encountered
OnStartArray public Event fired when a JSON array begins
OnStartObject public Event fired when a JSON object begins
OnStringValue public Event fired when a JSON string value is encountered
See all Events

Errors

Inherits error handling from TBaseJSONReader. Raises EJSONParser for parsing errors.

See also

Name Description
TBaseJSONReader Abstract base class for JSON readers
TJSONConsumerReader JSON reader that uses an IJSONConsumer for processing