EditSafely

Merge JSON Objects

Merge two JSON objects together.

Runs on your device, nothing uploaded

Arrays
Indent
Try:

0 chars · 0 lines

0 chars

Output

Merge two JSON objects together.

Type or paste above to see the result here.

Example: Deep-merge two configs

What you paste never leaves this tab

Merge JSON Objects is JavaScript that your browser has already downloaded, and it does the whole job on your own machine. On a normal site, an API response with live access tokens in it is sent to a server that can log it, cache it or keep it. Here it is read and transformed inside this tab and nowhere else.

  • No upload
  • No length limit
  • Works offline once loaded
  • Nothing stored or logged

How to use Merge JSON Objects

  1. 1. Paste the base and the overrides. Paste the base object into Base and the object whose values should win into Overrides, or open a file in each pane. Swap exchanges them, which flips which side wins.
  2. 2. Choose how to handle Arrays. Pick Replace so an array in Overrides fully replaces the same key's array in Base, or Concatenate to join both arrays together.
  3. 3. Check what was overridden. The note above the result lists every value Overrides changed, such as age and address.city. Values that are equal on both sides are not counted.
  4. 4. Copy or download the merged object. Copy the merged JSON, or download it as merged.json, with the indent you picked.

When to use Merge JSON Objects

Merge JSON Objects deep-merges two JSON objects, combining nested keys rather than just overwriting one with the other. It is for layering configuration or settings from two sources into a single, complete object.

  • Layering an environment override on a base config. A base config.json holds shared defaults, and an environment-specific file overrides just the database host and port. Merge them to get the final config for that environment.
  • Combining defaults with user preferences. An application ships a default settings object, and each user has a smaller file of saved preferences. Merge the two to get the complete settings for that user.
  • Combining partial API mocks. Two team members each wrote a partial mock response covering different fields of the same object, and you need one complete mock that includes both sets of fields.
  • Applying a theme override on a base theme. A base theme JSON defines default colors and spacing, and a smaller override file customizes just a few values. Merge them to produce the final theme file.

Examples

Deep-merge two configs

Input

{"db": {"host": "x"}}

Output

{
  "db": {
    "host": "x",
    "port": 5
  }
}

About the Merge JSON Objects tool

Merge JSON Objects does its work locally, right in the browser. Merge two JSON objects together. There is no upload step, no queue and no account, and your data never travels over the network.

It belongs to the JSON Tools collection on EditSafely, a set of 90 small, focused JSON utilities that share the same instant, private workspace.

You can shape the output with 2 settings, including Arrays and Indent, and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.

Running locally also makes the tool fast and dependable: results appear as soon as your input does, there is no server outage that can take it down mid-task, and confidential data can be processed without a second thought.

Frequently asked questions

Is Merge JSON Objects free to use?

Yes, it is completely free. All 2,943 tools on EditSafely work without an account, a subscription or usage limits.

Is it safe to paste sensitive or confidential data?

Everything happens locally. Your browser downloads the tool's code once, then does all the processing itself; nothing you enter is transmitted, stored or logged. You can even go offline after the page loads and it will still work.

How much text can I process at once?

There is no fixed limit; your device's memory is the ceiling. Up to 10 MB the result updates as you type, after a short pause that grows with the size. Above 10 MB a Run button appears so typing stays smooth, and files open up to 50 MB. A very long result shows its first 2,000 lines on screen, while Copy and Download always include all of it.

Do I need to sign up or install anything?

No. The tool works in any modern browser on desktop, tablet or phone. There is no account to create, no extension to add and no software to install.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.

Related tools

All JSON Tools →