ETEvoraTools
JSON Tools

Merge JSON Objects

Merge JSON Objects requires two parsed, non-array top-level objects and returns {...first, ...second} with two-space formatting. A matching key from the second object replaces the first value completely, including an entire nested object; arrays are values rather than merge targets. There is no recursive merge, conflict report, schema validation, prototype-key policy, array strategy, or undo.

Runs locally — files stay on your device
Quick answer

Are nested objects merged recursively?

No. The second nested value replaces the first at that top-level key.

Object spread performs a shallow overwrite

Only enumerable own top-level properties are copied into the result, in first-then-second order.

How it works

Both inputs pass JSON.parse and object/array checks; JavaScript object spread constructs the output.

Key concepts

Second wins

Duplicate top-level keys take the second value.

Nested replacement

No child-property reconciliation occurs.

When to use it

  • Overlay a small flat configuration.
  • Apply explicit top-level defaults and overrides.
  • Combine objects when replacement is intended.

When not to use it

  • Do not expect deep merge.
  • Do not merge arrays or primitive roots.
  • Do not accept unreviewed security-sensitive configuration keys.

Worked examples

Flat

Input
{"a":1} + {"b":2}
Expected output
{"a":1,"b":2}

Keys combine.

Conflict

Input
{"a":1} + {"a":2}
Expected output
{"a":2}

Second wins.

Nested

Input
{"x":{"a":1}} + {"x":{"b":2}}
Expected output
{"x":{"b":2}}

a is lost.

Common mistakes

Expecting deep merge

Nested object is overwritten. Correction: Choose a documented recursive strategy.

Merging arrays

Top-level arrays are rejected. Correction: Define concatenation or index rules separately.

Missing conflict review

No warning is emitted. Correction: Compare keys before merge.

Best practices

  • Use only when shallow precedence is intended.
  • Review duplicate keys.
  • Validate the resulting configuration against a schema.

Related operations and differences

CSV to JSON

Choose CSV to JSON when you need to convert a header-based CSV table to JSON.; use Merge JSON Objects specifically for json merge.

Extract JSON Values

Choose Extract JSON Values when you need to list every primitive value in a JSON document.; use Merge JSON Objects specifically for json merge.

JSON Beautifier

Choose JSON Beautifier when you need to format JSON with readable indentation.; use Merge JSON Objects specifically for json merge.

JSON Flattener

Choose JSON Flattener when you need to flatten nested objects into dot paths.; use Merge JSON Objects specifically for json merge.

JSON Key Sorter

Choose JSON Key Sorter when you need to sort object keys recursively.; use Merge JSON Objects specifically for json merge.

JSON Minifier

Choose JSON Minifier when you need to remove unnecessary JSON whitespace.; use Merge JSON Objects specifically for json merge.

Limitations and privacy

  • Top-level objects only.
  • Shallow second-wins spread; no deep strategy, array merge, conflict report, schema, safe-key policy, provenance, or patch output.

Input is processed locally in this browser and is not uploaded by the tool.

Frequently asked questions

Which object wins conflicts?

The second.

Are nested objects combined?

No.

Can arrays be merged?

Not as top-level inputs.

Is schema checked?

No.