[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'fpjson' (#fcl)

# SetJSONParserHandler

Set the JSON parser handler

## Declaration

Source position: fpjson.pp line 796

`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

SetJSONStringParserHandler |  | Install a JSON string to JSON Data conversion callback
GetJSONParserHandler |  | Get the current JSON parser handler
TJSONParserHandler |  | Callback to parse JSON into JSONData
GetJSON |  | Convert JSON string to JSON data structure