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 (.)

Syntax 

FLATTEN_JSON(object, [separator])

Usage examples 

Example 1

Input

1
{
2
"contact": {
3
"address": [
4
{
5
"city": "Huntsville",
6
"geo": {
7
"lat": "2.243232",
8
"lon": "1.23123"
9
},
10
"state": "NC",
11
"street": "101 3rd St",
12
"type": "home"
13
},
14
{
15
"city": "city",
16
"geo": {
17
"lat": "2.243232",
18
"lon": "1.23123"
19
},
20
"state": "NC",
21
"street": "15 Main St",
22
"type": "work"
23
}
24
],
25
"id": "557",
26
"name": "Jane Smith"
27
}
28
}

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 

Transform
My Action
Transform
FLATTEN_JSON

Select an action to inspect.

You can also click "Copy actions" and paste them in your Tines story to see how they work.

Was this helpful?