Decode JSON
Overview
This step typically follows a Real Time Input step
DDE rules can only accept data via a JSON message
The Decode JSON step will read the message and split the message into fields
The fields can then be referenced in the rule
The JSON message can be complex and have multiple arrays
Multiple Decode JSON steps can be used to ensure all the arrays are decoded
Example:
Following from the Real Time Input:
The Decode JSON step will create the following fields and data that can used in the rule:
Data Received | Decoded |
{
"id": "1",
"title": "Mr",
"firstname": "John",
"lastname": "Doe",
"color": "Blue"
} |
|
Plugin Configuration
General
Within the General tab:
The following settings can be configured:
Setting | Description |
---|---|
Field to decode | The JSON field to decode. This is typically the field called “message” passed down from from the Realtime Input. |
Expand size 1 arrays? | If the JSON contains a single object, and this object has an array then expand out the contents of that array into the row of data. i.e. Traverse all the nodes of the JSON object tree. Example: For the following the following JSON: {
"Customer": [
{
"ID": "1",
"Name": "Joe",
"PhoneNumber": [
{
"Home": "0123456789",
"Mobile": "1011121314"
}
]
}
]
} If the this option is ticked and the “Get Fields” button is selected, the JSON would traverse all arrays and decode to the following fields:
If the this option is un-ticked and the “Get Fields” button is selected, the JSON would only decode the first array to the following field:
|
Flatten multiple rows using delimiter | If the JSON contains a single array of objects, flatten the values of that array into one row with multiple values in each field. Example: For the following the following JSON: [
{
"ID": "1",
"Name": "Bill"
},
{
"ID": "2",
"Name": "Maria"
}
] If the this option is ticked, the JSON would decode to the following data: If the this option is un-ticked, the JSON would decode to the following data: |
Fields
Within the Fields tab:
The following settings can be configured:
Setting | Description |
---|---|
Name / Type / Required | The field names and data types of the fields being decoded. It is possible to automatically populate this list by selecting the “Get Fields” button. The “Required” option has the following options:
|
Rows of input to scan | The amount of rows within the data to scan to populate the fields grid when the “Get Fields” button is selected. Typically this will be the amount of rows that have been populated within the “Test Data” tab within the “Realtime Input” step. |
Rename | Allows the Field to be renamed before it leaves the JSON Decoder. |