[Overview][Constants][Types][Classes][Procedures and functions][Index] |
Create a new instance of JSON object data.
Source position: fpjson.pp line 527
public constructor TJSONObject.Create; |
const Elements: array of Const |
); overload; |
Elements |
|
Names and corresponding values to be added to the object |
Create creates a new JSON object instance, and initializes the data with Elements. Elements is an array containing an even number of items, alternating a name and a value. The names must be strings, and the values are converted to various TJSONData instances. If a value is an instance of TJSONData, it is added to the object array as-is.
The data type of the inserted objects is determined from the type of data passed to it, with a natural mapping. A Nil pointer will be inserted as a TJSONNull value. The following gives an example:
Var O : TJSONObject; begin O:=TJSONObject.Create(['Age',44, 'Firstname','Michael', 'Lastname','Van Canneyt']);
An EConvertError exception is raised in one of the following cases:
Add |
||
|
JSON factory: Get the JSONData class types to use |