Unit 'fpjson' Package
[Overview][Constants][Types][Classes][Procedures and functions][Index] [#fcl]

GetJSON

Convert JSON string to JSON data structure.

Declaration

Source position: fpjson.pp line 818

function GetJSON(

  const JSON: TJSONStringType;

  const UseUTF8: Boolean = True

):TJSONData;

function GetJSON(

  const JSON: TStream;

  const UseUTF8: Boolean = True

):TJSONData;

Arguments

JSON

  

The JSON to parse.

UseUTF8

  

Convert Unicode characters to UTF-8.

Function result

The TJSONData data (tree) represented by JSON.

Arguments

JSON

  

The JSON to parse.

UseUTF8

  

Convert Unicode characters to UTF-8.

Description

GetJSON will read the JSON argument (a string or stream that contains a valid JSON data representation) and converts it to native JSON objects. The stream must be positioned on the start of the JSON.

The fpJSON unit does not contain a JSON parser. 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 a callback that is used by GetJSON to parse the data.

If UseUTF8 is set to true, then Unicode characters will be encoded as UTF-8. Otherwise, they are converted to the nearest matching ansi character.

Errors

An exception will be raised if the JSON data stream does not contain valid JSON data.

See also

GetJSONParserHandler

  

Get the current JSON parser handler.

SetJSONParserHandler

  

Set the JSON parser handler.

TJSONData

  

Base (abstract) object for all JSON based data types.


Documentation generated on: Nov 23 2024