StoreJson Method (XDATA)
9.8A
The StoreJson method stores the XDATA nodes as a JSON formatted string into a Character String variable. The method uses the following format:
|
|
|
|
Where:
Flags Affected: EOS, OVER, ZERO
Note the following:
The EOS flag is set TRUE if the return variable is too small to receive the JSON string result without being truncated.
The ZERO and OVER flags are always cleared.
The *OPTIONS {mask} values are defined as follows:
|
Value |
Description |
|
0x2 |
This bit value causes JSON constructs to be indented. |
|
0x4 |
This bit value causes the JSON lines to output with a terminating <CR>+<LF> end of record sequence. |
|
0x40 |
This bit value causes the TAB (0x09) character to be used when the indent mask bit (0x2) is being used. If this bit is turned off, a blank (0x20) character is used for the indent operations. |
The XDATA is converted to a JSON stream using the following rules:
JSON
only uses the DOM_ATTRIBUTE_NODE, DOM_ELEMENT_NODE, and DOM_TEXT_NODE nodes from the XDATA. Any other
DOM node types are ignored.
A
JSON array is a DOM_ELEMENT_NODE with a label of array and jsontype of JSON_TYPE_ARRAY. It can have multiple
DOM_TEXT_NODE as values and multiple DOM_ELEMENT_NODE as object values.
A
JSON object is a DOM_ELEMENT_NODE with a label of object and jsontype of JSON_TYPE_OBJECT. It can have
multiple DOM_ATTRIBUTE_NODE and DOM_ELEMENT_NODE nodes as key value pairs.
See
the following link for basic JSON syntax elements and rules:
The {return} value is a NULL Character String variable if there is a memory allocation error creating a working buffer to hold the JSON output.
See Also: XDATA, XDATA Methods, Method Syntax
![]() |