Decode JSON
The Decode JSON action parses a JSON
string and populates the identified variables.
The Decode JSON action is part of the Technology Preview Extension
This action is part of the Technology Preview Extension, which is also referred to as the sandbox package. For information on obtaining and installing the extension, see Technology Preview Extension.
Parameter descriptions
Parameter | Description |
---|---|
JSON Template | The JSON description of the
variables to decode. Each variable is
specified as shown in the example
with:
|
Maximum String Size | Displayed when the Use
Advanced Properties checkbox
is selected. A default maximum string size of 256 is used for all variables on the Output tab that have a data type of String. The maximum string size can be modified by entering a value between 10 and 1024. |
Structure Delimiter Character | Displayed when the Use
Advanced Properties checkbox
is selected. Each member within a JSON structure must be represented at runtime as a unique variable. A unique name is created to identify each member in the structure. The name consists of the structure name, followed by a delimiter character, followed by the member name. The default character used to delimit between the structure name and the variable within the structure is the # character. This parameter can be used to change this value to another character. |
Input tab
Parameter | Description |
---|---|
JSON Input | The source of the JSON string when the trigger action is executed. This can be a variable or be a constant string. |
Output tab
Parameter | Description |
---|---|
Output variables | Each output variable identified from the JSON Template will be added as a row, allowing the parsed member to be assigned to a variable. |
resultStatus | An INT4 variable that will contain the completion status of this action. A value of zero indicates the JSON Input value was successfully parsed and matched the template identified in the JSON Template parameter. A non-zero value indicates the action was not successful. |
resultMessage | A String variable of 64 characters that will provide further information when the resultStatus is non-zero. |
Example
Here is an example JSON template. It contains a mix of
data types and includes an array of a structure named
INSTALLED_PART. The array contains two elements and has
members named partName, partSerialNumber, partStatus, and
timestamp.
Here is an example Output tab that corresponds to the
example the JSON template. The default value of 256 is used
for the Maximum String Size. The
# character is used to delimit the
structure name and the structure member name.