Hi everyone, I’m running into an issue with the Merge node in n8n. Both input branches clearly have data (I can see it in execution preview), but the Merge node is returning empty output.
My workflow looks like:
HTTP Request (A) → Merge ← HTTP Request (B)
Both nodes return data like this:
A:
[
{ “id”: 1, “name”: “John” }
]
B:
[
{ “user_id”: 1, “email”: “john@email.com” }
]
In the Merge node, I’m using Merge by Key with:
Input 1 key: id
Input 2 key: user_id
But the result is empty no items returned.
I expected something like:
[
{ “id”: 1, “name”: “John”, “email”: “john@email.com” }
]
Both nodes clearly have matching values (1), so I’m not sure why nothing is being merged.
Describe the problem/error/question
Am I missing something about how Merge by Key works in n8n? Could this be a data type issue or something else?
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
This is a classic Merge node gotcha. What is likely occurring is a data type mismatch. Both values might look like ‘1’, they are likely different. One is likely a number and the other is likely a string. This means the merge nodes comparison logic won’t match.
Normalize types before using the Merge node using Code or Edit Fields on either branch.
Example:
Input 1: `{{ $json.id.toString() }}`
Input 2: `{{ $json.user_id.toString() }}`
You’ll need to set both of the merge keys to the same field name and it should match correctly.
Also of note, in the execution preview- click into the actual field and look to see whether values have quotes around them, that is a good way to tell if it is a string or not.
Good answers above — the type mismatch is definitely the issue here.
One thing nobody mentioned yet: you can actually skip the Code node entirely and fix this right inside the Merge node itself.
In the Merge node settings, instead of using the raw field name, use an expression for the key:
{{ $json.user_id.toString() }}
This way you don’t need an extra node just for type conversion. Keeps the workflow cleaner.
That said, if you’re pulling data from two different APIs and merging them regularly, I’d honestly add an Edit Fields node right after each HTTP Request to normalize everything once — field names, types, date formats. Saves you from debugging this same issue every time the API returns something unexpected.