Just started diving into n8n from Integromat, so far love it, but am going a bit crazy with the documentation. I wish there was some documentation on the javascript notation needed to use the funtion nodes. What I have below is the output from a Set node.
Essentially, I need to take (could be any number of items, I’ve got two for the sake of this example):
[
{
"items":{
"63":[
{
"id":646,
"key":"pa_size",
"value":"s"
},
{
"id":647,
"key":"Product API ID",
"value":"777"
},
{
"id":648,
"key":"Artist",
"value":"2"
},
{
"id":649,
"key":"files",
"value":"link-to-file-1"
}
],
"64":[
{
"id":659,
"key":"pa_size",
"value":"xs"
},
{
"id":660,
"key":"Product API ID",
"value":"5554"
},
{
"id":661,
"key":"Artist",
"value":"2"
},
{
"id":662,
"key":"files",
"value":"link-to-file-2"
}
]
},
"name": "John Doe",
"address1": "19749 Dearborn St",
"city": "Chatsworth",
"state_code": "CA",
"country_code": "US",
"zip": "91311"
}
]
And turn it into:
{
"recipient": {
"name": "John Doe",
"address1": "19749 Dearborn St",
"city": "Chatsworth",
"state_code": "CA",
"country_code": "US",
"zip": "91311"
},
"items": [{
"Product API ID": 777,
"quantity": 1,
"files": [{
"url": "link-to-file-1"
},
{
"Product API ID": 5554,
"quantity": 1,
"files": [{
"url": "link-to-file-2"
}]
}]
}
Any help would be awesome, or even just a link to an example or two. Other than a link to the document page for the function nodes, that doesn’t have enough context for me to wrap my head around this.
Thanks!