PJSOCT – Parse JSON string (string output)

Block SymbolLicensing group: STANDARD
Qt SVG Document Exported by REXYGEN Studio jtxt RUN sy1 sy2 sy3 sy4 sy5 sy6 sy7 sy8 iE PJSOCT

Function Description
The PJROCT block parses input JSON string jtxt according to specified name* parameters when the input RUN is on. Output signals are string type.

This block expects text in JSON format on the jtxt input. The outputs of sy1 to sy7 then have the values of the objects identified by the parameters name1 to name7. If one of the parameters name1 to name7 is empty, the corresponding output will be empty and this is not considered as an error. The input string evaluates only if RUN = on. An error is indicated on the output iE. The following cases may occur:

  • 0 - no error
  • -1 - one of the parameters name1 to name7 refers to an object that does not appear in the input text (at the input jtxt)
  • -103 - the text on the input jtxt does not correspond to the JSON format
  • -106 - all of the parameters name1 to name7 refer to an object that does not appear in the input text (on the input jtxt)

Examples
Let
jtxt = "{"id": 12345, "params": {"temperature": 23, "pressure": 2.34 },
"description": "reactor1", "values" :[12, 34.5 , 45.0, 30.2]}"
name1 = "params.temperature",
name2 = "values[0]",
name3 = "pressure",
name4 = "description",
then the output sy1 will be the "23" string, the output sy2 will be the "12" string, output sy3 will remain empty and an error will be signaled, the output sy4 will be the "reactor1" string.

This block does not propagate the signal quality. More information can be found in the 1.4 section.

Input

jtxt

JSON formated string

String

RUN

Enable execution

Bool

Parameter

name1..name8

Name of JSON object

String

nmax

Allocated size of string   0  65520

Long (I32)

Output

sy1..sy8

String output value

String

iE

Error code

Error

2024 © REX Controls s.r.o., www.rexygen.com