JSONDATA


10.8, PLBCMP GUI Only

square.png Methods

 

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:

 

(1)

[label]

JSONDATA

[%|^][arraysize]

(2)

[label]

JSONDATA

^,{target}

(3)

[label]

JSONDATA

^(arraysize),({target}),...,({target})

 

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:

  1. The JSONDATA object is implicitly created when a method is executed.

  2. The JSONDATA object can be used in a DESTROY instruction.

  3. The alias JSON can be used in place of JSONDATA when declaring a JSONDATA object

  4. 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

 



PL/B Language Reference