
The Function Block JSON_ENCODE creates a JSON string.
Note: This function block can have more than four inputs. You can right-click on the function block to add another input. Note that the inputs are to be considered in pairs.
Defines the options as an integer with which the JSON string is created. These can be generated using the Function Block JSON_OPTIONS.
If the input is not defined or the value equals NULL, then the following options are active:
FORCE_OBJECT
UNESCAPED_SLASHES
PARTIAL_OUTPUT_ON_ERROR
UNESCAPED_UNICODE
Defines the maximum depth or object nesting in which the JSON format is created. If this value is reached during generation, then generating the JSON string fails and the output ERR is true.
The inputs define the variable or key that is inserted into the object. If subobjects need to be generated, these can be declared with a new line:
Sensor↵OG↵Status
If the input is not defined or equals NULL, then no data is added.
Defines the value that is inserted into the object with the upper key. The data types are observed. With the option NUMERIC_CHECK, every string can be automatically converted to a number.
If a number or another type must definitely be inserted, then the value can be converted beforehand using Function Blocks converted.
Returns the JSON string on success.
If an error occurs, this output is true.