Skip to main content

Merge

The Merge node combines two data streams into one.


Operations

There are 3 merge modes to choose from: Append, Combine, and Multiplex.

Append

All items of input 1, then all items of input 2. Specify the Number of Inputs to output items sequentially. The node waits until all inputs are processed.

For example: Two data sources (A, B, C and D, E, F) merge into: A, B, C, D, E, F.

Combine

Merge matching items together. The following combination modes are supported.

Merge by Fields

Combine items with the same field values. Specify fields in "Fields to Match".

Adjust "Output Type":

  • Keep Matches: Items that match, merged together (inner join).
  • Keep Non-Matches: Items that don't match.
  • Keep Everything: Items that match merged together, plus items that don't match (outer join).
  • Enrich Input 1: All of input 1, with data from input 2 added in (left join).
  • Enrich Input 2: All of input 2, with data from input 1 added in (right join).

Merge by Position

Combine items based on their order. Item at index 0 in Input 1 merges with index 0 in Input 2.

Multiplex

All possible item combinations (cross join), merging fields with identical names.

Combine Mode Options

For Combine mode, the following options are available:

Clash Handling

A clash occurs when multiple items at an index have a field with the same name, e.g., if all items in Input 1 and Input 2 have a field named product.

You can choose how to handle clashes:

  • When Field Values Clash: Choose input priority or add input number to field names.
  • Merging Nested Fields
    • Deep Merge: Merge at every level of nesting.
    • Shallow Merge: Merge at the top level only (all nested fields will come from the same input).
  • Minimize Empty Fields: Remove empty fields from the output.
Disable Dot Notation

Disable dot notation to prevent accessing child fields using parent.child.

Fuzzy Compare

Allow type differences when comparing fields. E.g., "1" and 1 are equivalent.

Multiple Matches

Decide how to handle multiple matches:

  • Include All Matches: Output multiple items if there are multiple matches.
  • Include First Match Only: Only ever output a single item per match.

Choose Branch

Output input data directly without modifying it. Ensure data from both inputs is available before proceeding.

Output options:

  • Input 1 Data
  • Input 2 Data
  • A Single, Empty Item

Examples

Create a workflow with some example input data to try out the Merge node.

Prepare Sample Data

  1. Add the first Code node, and paste the following code:
return [
{
json: {
product: "SugarCube",
category: "Confectionery",
price: 5.99,
},
},
{
json: {
product: "SugerPack",
category: "Packaging",
price: 2.99,
},
},
{
json: {
product: "SugarBowl",
category: "Kitchenware",
price: 12.49,
},
},
];
  1. Add the second Code node, and paste the following code:
return [
{
json: {
stock: 100,
product: "SugarCube",
},
},
{
json: {
stock: 50,
product: "SugerPack",
},
},
];
  1. Connect both Code nodes to the Merge node.

Then you can experiment with different merge modes.

Append

  1. Mode: Append.

The output looks like:

productcategorypricestock
SugarCubeConfectionery5.99
SugerPackPackaging2.99
SugarBowlKitchenware12.49
SugarCube100
SugerPack50

Combine by Matching Fields

  1. Mode: Combine.
  2. Combination Mode: Merge by Fields.
  3. Fields to Match: product for both Input 1 and Input 2.
  4. Output Type: Keep Matches.
  5. Output Data From: Both Inputs Merged Together.

The output looks like:

productcategorypricestock
SugarCubeConfectionery5.99100
SugerPackPackaging2.9950

Combine by Position

  1. Mode: Combine.
  2. Combination Mode: Merge by Position.

The output looks like:

productcategorypricestock
SugarCubeConfectionery5.99100
SugerPackPackaging2.9950

Combine by Multiplex

  1. Mode: Combine.
  2. Combination Mode: Multiplex.

The output looks like:

productcategorypricestock
SugarCubeConfectionery5.99100
SugerPackConfectionery5.9950
SugarCubePackaging2.99100
SugerPackPackaging2.9950
SugarCubeKitchenware12.49100
SugerPackKitchenware12.4950

Choose Branch

  1. Mode: Choose Branch.
  2. Output Data From: Input 1 Data.

The output looks like:

productcategoryprice
SugarCubeConfectionery5.99
SugerPackPackaging2.99
SugarBowlKitchenware12.49