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


JSON factory: Set the JSONData class types to use


Source position: fpjson.pp line 596

function SetJSONInstanceType(

  AType: TJSONInstanceType;

  AClass: TJSONDataClass





Type of data to register a class for



Class to use when a data item of type AType is encountered.

Function result

Previous JSON instance type


SetJSONInstanceType can be used to register descendents of the TJSONData class, one for each possible kind of data. The class type used to instantiate data of type AType is passed in AClass.

The JSON parser will use the registered types to instantiate JSON Data instanced: when the parser encounters a value of type AType, it will instantiate a class of type AClass. By default, the classes in the fpJSON unit are used.

The CreateJSON functions also use the types registered here to instantiate their data.

The return value is the previously registered instance type for the AType.


If AClass is not suitable to contain data of type AType, an exception is raised.

See also



JSON factory: Get the JSONData class types to use



Create a JSON data item

Documentation generated on: Sep 28 2017