Merge two JSON documents — deep recursive merge with array strategies (replace, concat, unique), shallow merge, or RFC 7386 JSON Merge Patch where null deletes a key.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
Three merge semantics, chosen explicitly
“Merge these two JSONs” hides three different operations, and picking the wrong one corrupts data quietly. Deep merge recurses into nested objects so the override document only mentions what changes — the config-layering classic. Shallow merge replaces whole top-level values. JSON Merge Patch (RFC 7386) is what many HTTP PATCH APIs — including Kubernetes — actually speak, with its special rule that null deletes a key. This tool makes you pick, and arrays get their own explicit strategy.
Worked example
Deep merge of base + overrides:
A: { "app": { "name": "Demo", "debug": false, "ports": [80] } }
B: { "app": { "debug": true, "ports": [443] } }Result (arrays: replace):
{ "app": { "name": "Demo", "debug": true, "ports": [443] } }When to use it
- Layering configuration: defaults + environment + local overrides.
- Building the merged state an RFC 7386 PATCH request would produce, before sending it.
- Combining partial records from two sources into one document.
Limitations to know
- Normal merges cannot remove keys — only Merge Patch mode (null deletes) or the Property Remover can.
- Array merging has no universal right answer; that is why replace/concat/unique is your explicit call.
Common errors and fixes
- A key vanished in Merge Patch mode — it was null in B; that is the RFC semantics, and the warning says so on every merge-patch run.
- Verify the result — diff it against A with JSON Compare to see exactly what the merge changed.
How to use the JSON Merge
- Paste the base document into JSON A and the overrides into JSON B.
- Pick the merge mode — deep, shallow, or RFC 7386 Merge Patch.
- For deep mode, choose the array strategy: replace, concat, or unique.
- Click "Merge JSON" and copy the result.
Frequently asked questions
What is the difference between deep and shallow merge?
Shallow only looks at top-level keys — a nested object in B replaces A's entire nested object. Deep recurses, combining nested objects key by key, so B only needs to mention what changes. Config layering (defaults + environment) is the classic deep-merge case.
How are arrays merged?
Your choice of three strategies: replace (B's array wins — the safest default), concat (A then B), or unique (concat minus exact duplicates). There is no universally correct answer, which is why it is an explicit option.
What is JSON Merge Patch?
RFC 7386 — the merge format used by many HTTP PATCH APIs (including Kubernetes). Its special rule: setting a key to null DELETES it from the target. This tool implements exactly those semantics in that mode.
How do I remove a key with a normal merge?
You cannot — merging only adds and overwrites. Use Merge Patch mode with null, or the Property Remover afterwards.