Skip to main content

CombineData

Uncontrolled node

Overview

The CombineData node merges two data inputs into a single output. It intelligently handles different data types—concatenating arrays, merging objects (dictionaries), and converting between arrays and objects when necessary. This is useful for aggregating data from multiple sources or building complex data structures.

Combination Logic

The node applies the following rules based on input types:

Input 1Input 2Output Behavior
ArrayArrayConcatenates both arrays ([...data1, ...data2])
ObjectObjectShallow merges both objects ({...data1, ...data2})
ArrayObjectConverts array to object with numeric keys, then merges with object
ObjectArrayConverts array to object with numeric keys, then merges with object
ArrayEmpty/NullReturns the array
ObjectEmpty/NullReturns the object
Empty/NullEmpty/NullReturns empty object {}
Array to Object Conversion

When combining an array with an object, the array indices become string keys in the resulting object (e.g., index 0 becomes key "0").

Inputs

InputTypeDescriptionDefault
data1DataFirst data input (array or object)-
data2DataSecond data input (array or object)-

Outputs

OutputTypeDescription
outputDataThe combined result based on the input types

Runtime Behavior and Defaults

  • Uncontrolled: This node runs automatically when data is available on its inputs; it does not require an event trigger.
  • Type Coercion: The node inspects the runtime types of inputs to determine the combination strategy.
  • Pass-through: If only one input receives data, that data is passed directly to the output without modification.
  • Empty State: If neither input receives data, the node outputs an empty object {}.
  • Shallow Merge: When merging objects, nested objects are not deeply merged—top-level keys from data2 will overwrite those from data1.

Example

Combining Lists

Connect two arrays to concatenate them:

Input data1: [1, 2, 3]
Input data2: [4, 5, 6]
Output: [1, 2, 3, 4, 5, 6]

Merging Dictionaries

Combine two objects to create a merged dictionary:

Input data1: {"name": "Alice", "age": 30}
Input data2: {"city": "New York", "age": 31}
Output: {"name": "Alice", "age": 31, "city": "New York"}

Mixed Types

When combining an array with an object, the array indices become object keys:

Input data1: ["apple", "banana"]
Input data2: {"fruit": "cherry"}
Output: {"0": "apple", "1": "banana", "fruit": "cherry"}