parse

parse(json:           String;
      type:           Class;
      createdObjects: ObjectArray input): Object;

The parse method of the JadeJson class parses JSON text to create and populate an object and all referenced objects.

The parse method parameters are the:

The return value is the object created from the parsed JSON string together with any referenced objects. It is the first object added to the array specified in the createdObjects parameter. The return value is null if the JSON contains null or is empty.

An exception is generated if the text cannot be parsed successfully.

If any object that would be created has a constructor method with parameters, exception 1188 (Constructor not called) is raised. To create an instance of a class that has a constructor method with parameters, the recommended approach is to create a proxy object (without a constructor method) which is then converted to the required object.

JSON text does not necessarily include a tag indicating the type of the data. If the JSON does not include a type tag, the JSON parser must assume that the data is of the correct type. Any properties not found on the class of any object are ignored and no error is raised. If the JSON text does not match the expected type, it could be because no property values are set on the created object or that the data does not match the property type.

The format type represented by the:

The following is a Microsoft example.

{"_type":"Customer","name":"smith","sex":"M", 
"description":"","ignore":false,"image":[]}

The following is a NewtonSoft example that shows an object with a type tag and an object identifier.

{"$type":"Customer","$id":"Customer4294967297","name":"Smith","bin":[],"description":"","ignore":false,"image":[]}

The following is an example of an array in the JSONN (NewtonSoft JSON) format.

1 {"$id":"ArrayOfInteger1", "$values":[1,2,3]}

In this example, the "$id" tag can be anything but it is unique for each array in the JSON string. You can use the $ref tag to reference already existing objects by array identifier. The "$values" tag contains all of the values for the array. The "$id" tag must come before the "$values" tag, the "$id" tag must have a string value, and the "$values" tag must be a square-bracketed ([ ]) array or it will not parse successfully and an exception will be returned.

The JSON for the description of each object includes the type of the object in the text.

2016.0.01 and higher