NokiaTube | New address | Mode Phone | On high quality
InitfinityTM
Initfinity / Docs / Nodes / Object Merge

Object Merge node

Combines two objects into one.

What it does

Merges Object A and Object B into one object on Merged. When both have the same key, the value from Object B wins.

Notes

  • The merge is shallow: a nested object from B replaces the one from A instead of being combined with it.
  • Text is parsed as JSON. If it is a JSON object it is used; if it is any other value it is stored under valueA or valueB.
  • A missing input counts as an empty object.
  • Arrays are objects in JavaScript, so merging one adds keys named by position. Wrap lists with a To Object node first.

Example

#fdl 1
flow "Merge defaults"
defaults(json) data=`{"theme": "light", "size": 12}`
mine(json) data=`{"theme": "dark"}`
both(object-merge)
result(json)

defaults.out -> both.a
mine.out -> both.b
both.out -> result.in

The result is { "theme": "dark", "size": 12 }.

Related nodes

Object Keys/Values · JSON · To Object

Open Initfinity