A Workflow Engine function that converts a nested JSON object (consisting of more than one level) into a flat JSON object with only a single level of depth (a key:value pairing).
Keys to deep objects are concatenated using a dotted notation. Values for all objects will be either strings or integers. Any value that is an array will be converted into a string representation of the array.
This function is available as a feature of the Add-ons v2.4 download and later.
This function is available for event, alert, and Situation workflows.
Back to Workflow Engine Functions Reference.
Workflow Engine function flattenObject
takes the following arguments:
Name | Required | Type | Description |
---|---|---|---|
| yes | string | The object to flatten. |
| yes | string | The location to store the flattened object. |
The following example demonstrates typical use of Workflow Engine function flattenObject
.
Given the following nested source object:
{
"key1" : "value 1",
"key2" : {
"key4" : "value 4",
"key5" : {
"key6" : "value 6"
}
},
"key3" : [ 1, 2, 3, 4, 5 ],
"key7" : 99
}
The flattened target object looks like this:
{
"key1" : "value 1"
"key2.key4" : "value 4",
"key2.key5.key6" : "value 6",
"key3" : "[1, 2, 3, 4, 5 ]",
"key7" : 99
}