The goal is to do subsequent HTTP posts from each item within the array, and then combining that data back together at the end.
However, I can’t find any information on how this merge module works. Does it combine the data back together in the proper way, with each item its subsequent data output in the right order?
Or would it mix up data when there are multiple items in an array?
The Merge node will now merge every single item from input 1 with every single item from input 2, returning a total of 6 items. If you were to place an HTTP Request node after the Merge node it would make 6 HTTP requests in total.
Now this data needs to be merged into an array again properly, not multiplied with each other.
So lets say area 3 comes from company America AM and area 4 comes from America PM. How do I combine this, into a JSON again so the data matches each other? Not multiply it.
Oh I see - the Multiplex node would indeed make things more complicated in this case.
But let’s unpack this step by step. The first problem I see are the different data structures. Neither of the example outputs provided appear to be multiple n8n items which actually seems like a step back from where we previously were.
So based on my understanding (and please correct me if my assumptions are wrong at any point), this would be a three step process:
First, let’s ensure that we have one n8n item per Value object as my understand is that these are the items you’d like to merge eventually.
I’d then assign unique keys (field names/column headers if you like) to each field to avoid accidentally overwriting any data (I’ve just appended 1 and 2 to the existing names in my example, but you might want to pick more descriptive names on your side).
Lastly, I’d merge the items based on their Id values using the Merge By Key mode of the Merge node.
Using your latest sample data this would give me two items in the end with fields from both branches (where the both items with Id 3 are merged together in one new item and both items with Id 4 are merged together in another item):