Creates a new JSON Entity.
Returns 1 if successful, 0 if not.
|Handle [OUT]||Variable to receive new handle to a JSON Entity. Required.|
|Type||The new entity's type: Array, Object, String, Number, or Boolean. Optional.|
|NewValue||The new entity's value. Optional.|
|Delim||The NewValue's delimiter. Optional. New in 2.1.1.|
The New service creates a new JSON entity. A JSON entity can be an object, array, string, number, boolean, or null. The type of entity created is determined by the Type parameter, which you can set to "Object", "Array", "String", "Number", "Boolean", or "Null". The NewValue parameter is also optional, but it provides a convenient way to initialize anything except objects, due to their inherent complexity.
VERSION NOTE: The ability to initialize arrays was added in version 2.1.1 and is not available prior to that. The Delim parameter allows initializing from any delimited array. If omitted, Delim defaults to @FM.
If you leave the Type parameter blank (or omit it altogether), then the type is automatically determined from the contents of NewValue. If NewValue is omitted completely, then "Object" is the type. If NewValue is included but empty, then "Null" is assumed. If NewValue contains a number, then "Number" is the type. In all other cases, the type defaults to "String".
This method's return value is not a JSON Entity Handle; it is a boolean indicating the success or failure of this service. The JSON Entity Handle is instead placed into the variable you pass into the Handle parameter. It is perfectly safe to set Handle to an unassigned variable, but you should check the return value to see if the entity was successfully created, like so:
IMPORTANT: Any JSON entity created by this service must be deallocated from memory when no longer needed using the Release service. Forgetting to do this on occasion will not cause a fatal error since SRP Utilities will clean up all its memory when OpenInsight closes, but frequently failing to release entities causes memory to get used up, which can become a problem over long periods of time.