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 1 | Input 2 | Output Behavior |
|---|---|---|
| Array | Array | Concatenates both arrays ([...data1, ...data2]) |
| Object | Object | Shallow merges both objects ({...data1, ...data2}) |
| Array | Object | Converts array to object with numeric keys, then merges with object |
| Object | Array | Converts array to object with numeric keys, then merges with object |
| Array | Empty/Null | Returns the array |
| Object | Empty/Null | Returns the object |
| Empty/Null | Empty/Null | Returns 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
| Input | Type | Description | Default |
|---|---|---|---|
| data1 | Data | First data input (array or object) | - |
| data2 | Data | Second data input (array or object) | - |
Outputs
| Output | Type | Description |
|---|---|---|
| output | Data | The 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
data2will overwrite those fromdata1.
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"}