Function Block JSON_DECODE

The Function Block JSON_DECODE decodes a JSON string.

Note: This function block can have more than two inputs or outputs. You can right-click on the function block to add another input or output.

Input JSON

The input expects a string in JSON format. An object is expected, starting with { and ending with } or starting with [ and ending with ].

Inputs VAR1..VAR#

The inputs define the variable or key after which the object is searched. If sub-objects need to be extracted, this can be declared with a new line:

Sensor↵OG↵Status

If the input is not defined or it is equal to NULL, no data will be extracted.

It is possible to query an array. The corresponding index can be queried as a number.

The result is output to the opposite output.

Output ERR

The output is true in case of an error. This is also the case if no value is present at the input JSON.

Outputs VALUE1..VALUE#

An output returns the extracted data of the opposite variable. If there are no data or the JSON value is equal to NULL, the value NULL will be returned.

If data or the searched object are not present, NULL is returned. If it is an object or array, the string Array will be returned.

Tip: To check if a value was defined, you can use the Function Block IS_NULL.

See Also