FLATTEN_JSON
Flattens nested JSON into a new object with a single layer of key/value pairs. Default key separator is a period or full stop (.)
Categories: Objects
Syntax
FLATTEN_JSON(object, [separator])
Examples
Example 1
Input
1
{
2
"json": {
3
"contact": {
4
"address": [
5
{
6
"city": "Huntsville",
7
"geo": {
8
"lat": "2.243232",
9
"lon": "1.23123"
10
},
11
"state": "NC",
12
"street": "101 3rd St",
13
"type": "home"
14
},
15
{
16
"city": "city",
17
"geo": {
18
"lat": "2.243232",
19
"lon": "1.23123"
20
},
21
"state": "NC",
22
"street": "15 Main St",
23
"type": "work"
24
}
25
],
26
"id": "557",
27
"name": "Jane Smith"
28
}
29
}
30
}
Formula
FLATTEN_JSON(json)
Output
1
{
2
"contact.address.0.city": "Huntsville",
3
"contact.address.0.geo.lat": "2.243232",
4
"contact.address.0.geo.lon": "1.23123",
5
"contact.address.0.state": "NC",
6
"contact.address.0.street": "101 3rd St",
7
"contact.address.0.type": "home",
8
"contact.address.1.city": "city",
9
"contact.address.1.geo.lat": "2.243232",
10
"contact.address.1.geo.lon": "1.23123",
11
"contact.address.1.state": "NC",
12
"contact.address.1.street": "15 Main St",
13
"contact.address.1.type": "work",
14
"contact.id": "557",
15
"contact.name": "Jane Smith"
16
}
Sample actions
Select an action to inspect
You can also click "Copy actions" and paste them in your Tines story to see how they work.