Language Reference Guide : 4. System Classes : JsonHandler Class : JsonObject2Object Method
 
Share this page                  
JsonObject2Object Method
Converts a JsonObject into an OpenROAD object.
This method has the following syntax:
Object = JsonHandler.JsonObject2Object(jsonobj = JsonObject[, existing_obj = object]
[, default_class = class][, default_row_class = class])
This method has the following parameters:
jsonobj
Specifies the JsonObject from which attribute values are used to populate an OpenROAD object.
existing_obj
Specifies an existing OpenROAD object that should be populated (rather than creating a new one).
default_class
Specifies the class to be used by default to create the object (if the JsonObject does not contain a "classname" member).
default_row_class
Specifies the default Row_Class if the object to be populated is an ArrayObject (if the JsonObject does not contain a "row_class" member).
If the method is successful, it returns a reference to the OpenROAD object populated; otherwise, it returns NULL.
The following mapping rules between the JsonValue subclasses and OpenROAD types apply:
JsonValue sublass
OpenROAD Type
JsonNull
NULL value (of any type)
JsonNumber
decimal, float (any precision), integer (any size), money
JsonBoolean
Any numeric type (values: true=1, false=0)
Note: There is no boolean type in OpenROAD.
JsonString
varchar, nvarchar, date
For mapping to a date, an absolute date has to be specified in ISO8601 format:
"yyyy-mm-ddThh:mi:ssZ" (for date with time)
"yyyy-mm-dd" (for date without time)
JsonObject
Object
If the IgnoreUnknownAttributes attribute of the JsonHandler is set to FALSE, then all members of the JsonObject must be serializeable attributes of the class of the object (see the SetSerializableClassAttributes() method).
JsonArray
There is no OpenROAD equivalent for the JsonArray.
The only use of a JsonArray is as the "rows" member of a JsonObject, that is mapped to an OpenROAD ArrayObject.
In this case the items in the JsonArray must be JsonObject instances.