DataToolsLab
JSON Tools

JSON Merge

Deep-merge multiple JSON objects with configurable array handling.

Loading tool…

What is JSON Merge?

The JSON Merge tool combines multiple JSON documents into one, with later sources overriding earlier ones for conflicting keys. Array handling is fully configurable via three strategies.

How it works

We recursively walk all objects, merging keys from each source in order. For arrays, you choose: replace (source array wins), concatenate (both arrays joined), or merge-by-index (merge element-wise). A conflict log shows which keys were overridden.

  1. Add documents to merge. Start with two documents (Base and Override), then add more as needed. Label each source to identify it in the conflict log.
  2. Choose array strategy. Pick how arrays are merged: replace, concatenate, or merge-by-index. The default 'replace' is safest for most use cases.
  3. Read the merged result. The merged output appears instantly. Expand the conflict summary to see which keys were overridden and by which source.

Examples

Config layering

Merge {"database":{"host":"localhost","port":5432}} with {"database":{"port":5433}} — result has port 5433 and host localhost.

Array concatenation

With 'concat' strategy, [1,2] merged with [3,4] produces [1,2,3,4].

Common mistakes

Wrong array strategy

Choosing 'replace' when you meant 'concat' silently drops target array items. Check the conflict log if something looks missing.

Source order matters

Documents are merged in order — later sources override earlier ones for the same key. Reorder documents if you need different precedence.

Alternatives

JSON Diff

See what changed between two documents.

JSON Patch Generator

Generate RFC 6902 patch operations instead of merging.

Frequently asked questions

Does it handle deeply nested objects?

Yes — the merge is fully recursive. Nested objects at any depth are merged key by key.

What happens to null vs undefined?

null is treated as a value and will override a previous key's value. If you want to remove a key, use the JSON Patch tool instead.

Online