Combine two or more JSON documents into one. Choose how arrays are joined and which value wins when the same key has different values, then review every overwritten value in the conflict report before you copy or download the result.
Last updated:
Advertisement
Advertisement
How to use the JSON Merge Tool
Paste the base JSON into the first box and the JSON to merge into it in the second box, or upload .json files.
Add more inputs if needed. They are merged left to right, top to bottom.
Choose the mode and array strategy, for example Deep merge with Union or Merge by key field id.
Set the conflict rule: later input wins (typical for config overrides) or earlier input wins (defaults fill gaps only).
Check the Conflicts tab, then copy the result or download merged.json.
Merge strategies compared
Example: merging {"tags":["a","b"],"db":{"host":"x","port":1}} with {"tags":["b","c"],"db":{"port":2}}, later input wins.
Setting
tags becomes
db becomes
Deep merge + Concatenate
["a","b","b","c"]
{"host":"x","port":2}
Deep merge + Union
["a","b","c"]
{"host":"x","port":2}
Deep merge + Replace
["b","c"]
{"host":"x","port":2}
Deep merge + Merge by index
["b","c"] (item by item)
{"host":"x","port":2}
Shallow merge
["b","c"]
{"port":2} (host is lost)
JSON Merge Patch (RFC 7396)
["b","c"]
{"host":"x","port":2}
Typical uses
Layered configuration: merge config.default.json, then config.production.json, then local overrides, with later input wins.
Combining API pages: union or concatenate the arrays returned by paginated endpoints into one dataset.
Syncing records: use Merge by key field id to update existing records and append new ones without duplicates.
Translation files: merge a base en.json first and a partial locale file second (later input wins), so translated strings replace the English ones and anything missing falls back to English.
Preparing a PATCH request: preview what an application/merge-patch+json body will do to a resource before sending it.
Rules worth knowing
Key order is preserved: keys from earlier inputs come first, new keys are appended in the order they appear.
Union and duplicate detection compare whole values, and object key order does not matter ({"a":1,"b":2} equals {"b":2,"a":1}).
Numbers are parsed as JavaScript numbers, so integers above 253 (about 9 quadrillion) may lose precision. Store very large IDs as strings.
Empty input boxes are skipped, so you can keep spare inputs open without affecting the result.
Frequently asked questions
What does deep merge mean for JSON?
A deep merge combines objects key by key at every level. If both inputs have an object under the same key, those objects are merged too, instead of the later one replacing the earlier one. Only when two values that are not both objects (for example two different strings) collide does the conflict rule decide which one is kept.
How are arrays merged?
It depends on the strategy. Concatenate appends the later array after the earlier one. Union does the same but skips items that are exactly equal to one already present. Replace treats the array as one value, so the conflict rule picks a whole array. Merge by index merges item 0 with item 0 and so on. Merge by key matches objects by a field such as id and merges matching objects, appending the rest.
What is JSON Merge Patch (RFC 7396)?
RFC 7396 defines a simple patch format: the patch looks like the target document, objects are merged recursively, any key set to null is removed from the target, and every other value, including arrays, replaces the old one. It is used by HTTP PATCH APIs with the content type application/merge-patch+json and by Kubernetes.
Which value wins when keys conflict?
By default the later input wins, which is how most configuration layers work: base settings first, then environment or user overrides. Choose Earlier input wins if the first document is authoritative and later ones should only fill in missing keys. Every decision is listed in the Conflicts tab.
Can I merge JSON arrays at the top level?
Yes. If every input is an array, the array strategy is applied at the top level, so you can concatenate lists, build a union, or merge records that share an id. Mixing an object and an array at the top level is a type conflict and the conflict rule picks one of them.
Is this the same as lodash merge or Object.assign?
Object.assign and the spread operator are shallow merges, like the Shallow mode here. Lodash merge is a deep merge that merges arrays by index, which matches Deep merge with Merge by index. Note that lodash skips undefined values but not null, which matches leaving the null option unchecked.
Are my files uploaded?
No. Parsing and merging happen in JavaScript inside your browser, so the JSON never leaves your device and the tool also works offline once the page has loaded.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.