JSONDATA
10.8, PLBCMP GUI Only
The JSONDATA PL/B object provides functionality to generate, retrieve, modify, and delete fields within a JSONDATA object. Each field consists of a key-value pair using the standard JSON syntax: "key":value. In addition to basic types, the PL/B JSONDATA object supports complex types-- object and array -- which are represented using curly braces {} and square brackets [], respectively.The declaration syntax of a JSONDATA object is as follows:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where:
label
Optional. A Data Label.
%
Optional. Denotes the item as being GLOBAL.
arraysize
Required. An integer decimal constant, CONST variable, or EQUATEd value indicating the number of array items.
^
Optional. Denotes the item as being a POINTER.
target
Required. The name of a previously defined data item of the same type.
Flags Affected: NONE
Note the following:
The JSONDATA object is implicitly created when a method is executed.
The JSONDATA object can be used in a DESTROY instruction.
The alias JSON can be used in place of JSONDATA when declaring a JSONDATA object
The JSON field types are broken down into the following basic types for the JSONDATA PL/B object:
|
JSON Type |
Description |
Example |
|
string |
Text enclosed in double quotes. |
"name":"James" |
|
number (Integer) |
Integer value. |
"age":54 |
|
number (Double) |
Floating-point value. |
"score":95.8 |
|
boolean |
Logical true/false. |
"active":true |
|
null |
Explicitly represents no value. |
"middleName":null |
|
object |
Collection of key-value pairs. |
"user":{"id":1,"name":"E"} |
|
array |
Ordered list of values (any type). |
"tags":["dev","win32"] |
See Also: Object Definitions
![]() |