PARSE Method (JSONDATA)


10.8, PLBCMP GUI Only

 

The Parse method is used to make nodes in the JSONDATA object from a valid JSON string. This method verifies and validates the JSON string syntax. This method uses the following format:

 

 

[label]

{object}.Parse

[GIVING {return}] USING [*JSON=]{json}[:

 

 

[*OPTIONS=]{options}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A JSONDATA object previously declared.

return

Optional. A Numeric Variable that returns a pass (zero) or fail (non-zero) value.

json

Required. A Character String Variable or literal that contains a valid JSON object stream.

options

Optional. A Numeric Variable, decimal number, or Numeric expression that defines a bit mask value that is used to control the behaviors of this method.

Flags Affected: EOS, OVER, ZERO

Notes:

  1. The EOS flag is always cleared.

  2. The ZERO flag is set if the return value is zero. Otherwise, the ZERO flag is cleared for non-zero values.

  3. The OVER flag is set if the return value must be truncated.

  4. The {options} bit mask values are defined as follows:

  5.  

    Option

    Value

    Meaning

    $JSF_PARSE_ALLOW_COMMENTS

    0x01

    Allow comments in the JSON input data.

     

  6. When this method generates an error, the {return} variable contains the error codes:

  7.  

    Error

    Description

    1

    Memory allocation error.

    2

    JSON parse error. Check SyntaxError method!

    3

    JSON unknown type.

    10nn

    Filter expression error.

    1199

    Invalid JSON stream.

     

  8. If an error occurs, the JSONDATA object method 'SyntaxError' can be used to retrieve that last error that was generated.

 

 

See Also: Method Syntax, JSONDATA Methods



PL/B Language Reference