Was this helpful?
WriteFile Method
Writes the JSON for JsonValue subclass object into a file.
This method has the following syntax:
integer = JsonHandler.WriteFile(value = JsonValue, filename = varchar(256)
[, indented = integer][, sortobjectmembers = integer][, checkcircularrefs = integer])
This method has the following parameters:
value
Specifies the JsonValue to be written to a file.
filename
Specifies the name of the file the JSON will be written to.
indented
Specifies whether the JSON should be written indented.
sortobjectmembers
Specifies whether the members of the JSON objects written will be sorted by name. TRUE sorts the object members.
checkcircularrefs
Specifies whether the value should be checked for circular references between JsonObject or JsonArray instances to be written. If set to TRUE, it will check for circular references before actually writing JSON (default is FALSE to prevent the performance overhead). The method will return ER_FAIL if a circular reference is encountered, and the Errortext attribute will be set accordingly.
A circular reference between JsonObject or JsonArray instances is a programming mistake, as this is not allowed in JSON. If a circular reference exists and checkcircularrefs is FALSE, it causes a termination of OpenROAD due to stack overflow (as there is an infinite write of JSON data).
If the method is successful, it returns ER_OK; otherwise, it returns ER_FAIL.
Last modified date: 12/20/2023