Split, loop, then merge (please explain)

Problem

I want to parse a json object and split out its structure, loop through it to do some data transformation, then concat it back to its original structure.

I am now struggling with the Merge node. I can’t find a way to successfully merge all the data (by each loop) into correct number of loops/items. (Please see the below workflow.)

I split out the json into 9 loops, and have 52 items in total.
I want to do some data transform for text and table object then merge back into the original loop.
If I connect text, pic, and other, the loops and the items will be correct (see node Merge, which is my desire output), but when adding table path as input2 of Merge the loops and items counts become strange and incorrect. I’ve tried with the append mode and outer join of SQL mode in merge node, both have same issue when adding table as input.

The problem exist even if I eliminate the data transform node, so the question should be: How to correctly using merge node (or other?) to merge all the split data into its own loop?

Workflow

Output returned by the last node

Output: 2 runs with total 11 items.
Expected output: 9 runs with total 52 items (with transformed data).

Information on your n8n setup

  • n8n version: 1.77.3

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @ocus

You should pack items again, so the number of items the Loop node receives matches the number it outputs

1 Like

Hi @barn4k,

Thanks! This works like a charm and is exactly what I want to achieve.

Thanks for your prompt rescue :smiley:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.