parseFile
parseFile(type: Class; createdObjects: ObjectArray input; fileName: String; usePresentationClient: Boolean): Object;
The parseFile method of the JadeJson class reads and parses JSON text from a file to create and populate an object and all referenced objects.
The parseFile method parameters are:
-
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 fileName parameter specifies the name of the file to read.
-
The usePresentationClient parameter specifies where the file is to be read. It specifies true if the file is to be read on the presentation client and the JADE process is a thin client; otherwise the file will be read from the same node where the logic is executing (an application server, a server, or a client for a standard (fat) client process).
The return value is the object created from the parsed JSON string in the file together with any referenced objects. (It is the first object added to the array specified in the createdObjects parameter.)
The returned 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.
2016.0.01 and higher