Nodes
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 object b
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
a
andb
input ports. If no objects are connected, the node will use the default empty object{}
. - The node will output the deeply merged object on the
result
port.
Example#
Suppose you have two objects:
When you pass these objects through the Merge Deep (Object) node, the output will be:
Notice how:
- The
user
object is merged recursively age
from object B overwrites the value from object Aemail
is added from object B- The
address
object is merged, withcity
from object B overwriting the value from object A - The
settings
object is merged, withlanguage
added 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
b
will 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
a
andb
inputs. - If you want a shallow merge instead of a deep merge, use the Merge (Object) node instead.