JSON: Merge¶
Merges two JSON objects. Supports shallow (overwrite) or deep (recursive) merge modes. If inputs are strings, they are parsed as JSON; in deep mode, nested dictionaries are merged while non-dict values are overwritten by the second input.

Usage¶
Use this node to combine configuration objects, parameter sets, or partial payloads into a single JSON object. Choose shallow when you want json2 to overwrite json1 at the top level; choose deep to recursively merge nested dictionaries. Feed the result to downstream nodes that require a unified JSON object.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| json1 | True | WILDCARD | First JSON object (or JSON string) to merge. If a string is provided, it will be parsed; invalid or empty strings become an empty object. | {'a': 1, 'b': {'x': 10}} |
| json2 | True | WILDCARD | Second JSON object (or JSON string) to merge. Values from json2 overwrite or merge into json1 depending on the mode. If a string is provided, it will be parsed; invalid or empty strings become an empty object. | {'b': {'y': 20}, 'c': 3} |
| merge_mode | True | ["shallow", "deep"] | Select the merge strategy. 'shallow' overwrites top-level keys with json2. 'deep' recursively merges nested dictionaries; non-dict values are overwritten by json2. | deep |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| merged_data | WILDCARD | The merged JSON object after applying the selected merge strategy. | {'a': 1, 'b': {'x': 10, 'y': 20}, 'c': 3} |
Important Notes¶
- Parsing behavior: If json1 or json2 are strings, the node attempts to parse them as JSON. Invalid or empty strings become {} before merging.
- Type requirements for merge: Only dictionaries are merged. If either input is not a dictionary (e.g., a list or scalar), the node returns json2 as the result.
- Shallow vs Deep: Shallow merge applies {json1, json2}; deep merge recursively merges dictionary values, while arrays and scalars are overwritten by json2.
- Error handling: On merge errors, the node logs an error and returns json1 unchanged.
- No array merging: Arrays/lists are not merged element-wise; if encountered at any key, json2's value replaces json1's value.
Troubleshooting¶
- Output is just json2: Ensure both inputs parse to dictionaries. If an input is a list, number, string (unparsed), or None, the node will return json2.
- Fields not merging as expected: Confirm 'merge_mode' is set to 'deep' for recursive merging. In 'shallow' mode, only top-level keys are considered and json2 overwrites json1.
- Invalid JSON string inputs: If providing strings, ensure they are valid JSON. Invalid strings are treated as {} which may lead to unexpected overwrites or missing data.
- Nested arrays not combined: This node does not merge arrays. If you need array concatenation or custom list merging, preprocess those keys before using this node.