Hello all,
I’ve recently started using n8n and am loving it, mentioning it to people to increase its popularity
I have a JSON like following and I need to flatten it to a single degree; I tried searching for it on the web and this forum, but couldn’t succeed. Any help would be appreciated…
I would like to convert this
{
“id”: “xxxxxxxxxxxxxxx”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64)”,
“location”: “Istanbul, Turkey”,
“date”: “2020-12-02T11:56:05.106Z”,
“campaignId”: “yyyyyyyyyyyyyyyy”,
“customData”: {
“aaa-1111”: “Evet”,
“aaa-1112”: “Evet”
},
“data”: {
“bbb-1111”: “Evet”,
“bbb-1112”: “Evet”
},
“url”: “https://www.tttttt.com.tr/”,
“time”: 5167
}
to
{
“id”: “xxxxxxxxxxxxxxx”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64)”,
“location”: “Istanbul, Turkey”,
“date”: “2020-12-02T11:56:05.106Z”,
“campaignId”: “yyyyyyyyyyyyyyyy”,
“aaa-1111”: “Evet”,
“aaa-1112”: “Evet”,
“bbb-1111”: “Evet”,
“bbb-1112”: “Evet”,
“url”: “https://www.tttttt.com.tr/”,
“time”: 5167
}
basically promoting the children of data and customdata nodes. I could prefer to get the names changed to customData.aaa-1111 and data.bbb-1111 but that’s not mandatory