Merge Deep (Object)
The Merge Deep (Object) node deeply merges two objects, recursively combining their properties. If both objects have a property with the same key, the values will be merged if they are both objects, otherwise the value from objectb will overwrite the value from object a.
Inputs
a(object, default:{}): The first object to merge.b(object, default:{}): The second object to merge.
Outputs
result(object): The merged object.
Configuration
This node has no configuration options.Usage
To use the Merge Deep (Object) node:- Connect two objects to the
aandbinput ports. If no objects are connected, the node will use the default empty object{}. - The node will output the deeply merged object on the
resultport.
Example
Suppose you have two objects:- The
userobject is merged recursively agefrom object B overwrites the value from object Aemailis added from object B- The
addressobject is merged, withcityfrom object B overwriting the value from object A - The
settingsobject is merged, withlanguageadded from object B
Best Practices
- Use Merge Deep (Object) when you need to combine two objects while preserving the structure of nested objects.
- Be aware that properties from object
bwill overwrite properties with the same key in objecta, unless both values are objects, in which case they will be merged recursively.
Common Issues
- If either input is not an object, the node will throw an error. Ensure that you are connecting objects to the
aandbinputs. - If you want a shallow merge instead of a deep merge, use the Merge (Object) node instead.
