Skip to content

TJSONParserHandler

Callback to parse JSON into JSONData.

Declaration

Source position: fpjson.pp line 792

type
  TJSONParserHandler = procedure(AStream: TStream; 
                               const AUseUTF8: Boolean; 
                               out Data: TJSONData);

Arguments

Name Description
AStream Stream to parse.
AUseUTF8 Use UTF-8 in returned ansistrings.
Data Resulting JSON data.

Description

TJSONParserHandler is a callback prototype used by the GetJSON function to do the actual parsing. It has 2 arguments: AStream, which is the stream containing the JSON that must be parsed, and AUseUTF8, which indicates whether the (ansi) strings contain UTF-8.

The result should be returned in Data.

The parser is expected to use the JSON class types registered using the SetJSONInstanceType method, the actual types can be retrieved with GetJSONInstanceType

See also

Name Description
GetJSON Convert JSON string to JSON data structure.
SetJSONInstanceType JSON factory: Set the JSONData class types to use.
GetJSONInstanceType JSON factory: Get the JSONData class types to use.