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 json parameter specifies the source string to parse in Microsoft or NewtonSoft format (parser handles both formats without needing to know the type of the JSON).
-
The type parameter specifies the object type of the data. If the JSON text includes a type tag, the type tag must be the same as the class specified in this parameter or a subclass of the specified class. An object of that type is created and populated. If the JSON does not include a type tag, an object of the class specified in the type parameter is created and populated.
-
The createdObjects parameter specifies a transient object array supplied by the caller. All objects created are added to the array (the array is not cleared by the method). It is the responsibility of the caller to delete all objects returned from the method.
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.
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.
2016.0.01 and higher