JSON Merge Tool

Deep-merge two JSON objects — nested keys combine, arrays and scalars override.

  • 100% client-side · your data never leaves your browser
  • Instant, no rate limits
  • Free, no sign-up
JSON A (base)
JSON B (merge in)
Merged JSON

Paste two JSON documents to merge.

Overview

JSON Merge Tool — Deep Merge Two JSON Objects

Merge two JSON documents with deep (recursive) object combining. Nested keys merge instead of replacing the whole branch; scalar and array values from the second document override the first. Perfect for layering config defaults with environment overrides, combining feature flags, or prototyping patch semantics — all locally in your browser.

No uploadsNo sign-upOpen source
  1. How deep merge works

    When both sides are objects at the same key, merge recurses into children. When types differ or the second value is not an object, the second document wins. Arrays are replaced entirely rather than concatenated — matching common config-overlay patterns.

  2. Config defaults and overrides

    The classic use for deep merge is layering configuration: start with a base document of defaults and merge an environment-specific overlay on top. Keys present only in the base are kept, keys in the overlay win, and nested sections combine instead of being wiped out — the same model used by Helm values, application settings, and feature-flag layering.

  3. Merge vs JSON Patch

    Merge is a declarative overlay: paste a base and an overlay and get the combined result. JSON Patch (RFC 6902) is operation-based — add, remove, replace — and is designed for versioned API updates. Use merge for quick config composition; generate a patch from the Compare tool when you need an auditable list of changes.

  4. How arrays are handled

    Arrays are replaced whole, not concatenated or merged element-by-element. This matches how config overlays usually behave: if an override specifies a list, it means 'use exactly this list.' If you need element-level array changes, use the Compare tool's JSON Patch output instead.

FAQ

Frequently asked questions

How do I merge two JSON objects?

Paste a base document and a second document; JsonDrift deep-merges them so nested objects combine and the second document's values win on conflicts.

Are arrays merged element-wise?

No. The second JSON's array replaces the first at that key, matching common config-overlay semantics.

Which document takes priority?

The second (overlay) document wins wherever the two conflict; keys unique to the base are preserved.

What if one input is invalid?

Both documents must be valid JSON. Run them through the JSON Validator or JSON Repair tool first.

Continue with a related tool

All tools

Learn more in our guides

All guides