Iterate over nested array

Hello,

Thanks for the amazing job you’ve done.

I still have trouble understand loop in n8n.

Here is my scenario :

  • I get data from external api, the shape of data looks like that
[
 {
   id: 1, 
   data: [ {id: a}, {id: b} ]
 }, 
 {
   id: 2, 
   data: [ {id: c}, {id: d} ]
 }
]

I want to make 1 http call for each element in data array, update element with new data and restore updated data in the original object.

The result should looks like that :

[
 {
   id: 1, 
   data: [ {id: a, ...more data}, {id: b, ...more data} ]
 }, 
 {
   id: 2, 
   data: [ {id: c...more data}, {id: d...more data} ]
 }
]

My question is how to execute a node for each element in data array and restore the array with updated data in the original object ?

Thanks

I ended up doing it manually but I’m curious to have feedback about the correct way to handle this scenario with n8n.

Here is a simplify version of my workflow :