Release Summary : 1. New Features : JSON Classes Added : JsonHandler Class
 
Share this page                  
JsonHandler Class
The JsonHandler class provides methods for parsing and writing JSON documents (from or into a file or StringObject) and to do conversions between JsonValue (subclass) objects and OpenROAD objects and scalars. It has the following attributes:
AlwaysAddClassname
Data Type: integer
4GL Access: RW
Defines whether to add a "classname" member for any object and a "row_class" member for any ArrayObject when converting OpenROAD objects into JSON.
If set to FALSE (default), these members are only added, if the object referenced is different from their defined type (i.e. if it references a subclass object/array).
IgnoreUnknownAttributes
Data Type: integer
4GL Access: RW
Defines if unknown attributes should be ignored (with WARNING message generated) when converting a JsonObject into an OpenROAD object. Default: FALSE
MaxNestingLevel
Data Type: integer
4GL Access: RW
Defines the maximum nesting level for circular or multiple references when converting OpenROAD objects into JSON.
If set to 0 (default), the additional "$id" and "$ref" meta attributes are used in JSON instead (one object has "$id" attribute, other referencing objects have the "$ref" attribute with the same value).
Errortext
Data Type: varchar(2000)
4GL Access: RO
Contains the Errortext of the last method invocation.
The JsonHandler class has the following methods:
JsonObject2Object
Converts a JsonObject into an OpenROAD object.
JsonRpcRequest
Executes a JSON-RPC 2.0 (jsonrpc) request (or batch/array of requests) given as a StringObject. It returns a StringObject containing the response (NULL for a "Notification" request).
NewJsonValue
Creates a new JsonValue subclass object for a given value (scalar or object).
Object2JsonValue
Converts an OpenROAD object into a JsonValue (JsonObject or JsonNull).
Parse
Parses a StringObject containing JSON and returns a JsonValue subclass object representing the JSON.
ParseFile
Parses a file containing JSON and returns a JsonValue subclass object representing the JSON.
SetSerializableClassAttributes
Sets the serializable attributes for a class.
Write
Writes the JSON for JsonValue subclass object into a StringObject.
WriteFile
Writes the JSON for JsonValue subclass object into a file.