JSON Merge

Merge two or more JSON objects. Later keys overwrite earlier. Deep merge option. 100% client-side.

Related Tools

What This JSON Merge Tool Offers

Merge two JSON objects into one: a base (JSON 1) and an overlay (JSON 2). Overlay keys overwrite base; with deep merge, nested objects are merged recursively. Paste or upload each side; invalid input shows which side failed, a snippet, and links to the Formatter and Validator. Clear resets both inputs and output. Choose indent 2 or 4 spaces. Download or copy the result. All processing is client-side.

  • Shallow or deep merge: Shallow: only top-level keys; overlay overwrites base for each key. Deep: nested objects are merged recursively so you can combine configs without losing nested keys.
  • Error handling: Invalid JSON in either input shows which side (base or overlay) failed, the parser message, and when available a snippet. Links to Formatter and Validator help you fix the input.
  • Clear: One click clears both text areas, the merged output, and file inputs so you can start with new JSON.
  • Powered by browser APIs and client-side processing.

Why Merge JSON?

Configs and API payloads often need to combine a default object with overrides. Merging two objects gives one result where overlay values take precedence; deep merge does the same for nested objects so you can layer defaults and environment-specific settings. Running the merge in the browser keeps your data private and works offline after the page loads.

Options at a Glance

  • JSON 1 (base): The first object. Paste or upload a .json file.
  • JSON 2 (overlay): The second object. Keys here overwrite base. Paste or upload.
  • Deep merge: When checked, nested objects are merged recursively. When unchecked, overlay keys replace base keys at the top level only.
  • Indent: 2 or 4 spaces for the merged output.
  • Clear: Clears both inputs, output, any error, and file inputs.

Frequently Asked Questions

Is my data secure?

Yes. Merging runs entirely in your browser. Your data never leaves your device and is not sent to any server.

How does overwrite work?

When merging, if the same key exists in both objects, the value from the overlay (JSON 2) is used. With deep merge, nested objects are merged recursively instead of replacing the whole nested value.

What if my JSON is invalid?

The tool shows which input (base or overlay) failed, the parser error message, and when available a short snippet around the error. You get links to the JSON Formatter and Validator to fix the input.

Can I load from files?

Yes. Use the file input under each text area to load a .json file for base and overlay. Loading new content clears the previous output and any error.