Sign in Join
FPDoc Onlineexperiment

SetJSONParserHandler function

In unit fpJson

Set the JSON parser handler.

Declaration

pascal
function SetJSONParserHandler(AHandler: TJSONParserHandler)
: TJSONParserHandler

Arguments

AHandler

The new value for the handler.

Function result

Previous JSON Parser handler.

Description

SetJSONParserHandler can be used to set the JSON parser handler callback. The fpJSON unit does not contain a JSON parser in itself: it contains simply the data structure and the ability to write JSON. The parsing must be done using a separate unit, and is invoked through a callback. SetJSONParserHandler must be used to set this callback.

The jsonparser unit does contain a JSON parser, and must be included once in the project to be able to parse JSON. The jsonparser unit uses the SetJSONParserHandler call to set the callback that is used by GetJSON to parse the data. This is done once at the initialization of that unit, so it is sufficient to include the unit in the uses clause of the program.

The function returns the previously registered callback.

This handler uses a stream as input. For speed reasons you can also register handler that converts a string to JSON data. This is done with the SetJSONStringParserHandler call.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.