Skip to content

Deep Merge JSON Tool

Paste the base and overlay documents, pick the array strategy and the scalar conflict rule, then read the merged JSON and the operation log.

Runs locally in your browser
1Base JSON2Deep merge3Merged JSON

Base JSON
Overlay JSON

How to merge two JSON documents with explicit conflict and array rules

The tool merges an overlay JSON document into a base document and writes the result as pretty-printed JSON. Objects are merged key by key, recursively: a key that only the overlay has is added, and a key that both documents share is resolved by the scalar conflict rule — use the overlay value, keep the base value, or stop with an error that names the path.

Arrays follow the strategy you choose: replace (the overlay array wins), concatenate (base items followed by overlay items), concatenate unique (the same without repeated values) or merge objects by key (items with the same value in the key field are merged, new items are appended). Everything runs in the browser, and every change is listed path by path under Merge operations.

  1. Paste the base document into Base JSON and the overlay into Overlay JSON, or press Load example for a keyed example that already merges an array by id.
  2. Choose the Array strategy: Replace array, Concatenate arrays, Concatenate unique values, or Merge objects by key. The Array object key field appears for the keyed strategy and defaults to id.
  3. Choose the Scalar conflict rule: Use overlay value (the default), Keep base value, or Stop on conflict, which reports the first conflicting path and produces no result.
  4. Press Merge JSON. The Merged JSON pane shows the result, and Merge operations lists every change path by path — add, use overlay, keep base, replace array, concatenate arrays, concatenate unique array values, or merge array objects by key. The metrics report the operation count, the output size in bytes and the result type.
  5. Use Copy or Download to take the result as voritools-merged.json, and Clear to empty both inputs, the result, the log and the metrics. If a document is not valid JSON, or keyed merging runs without a key, the panes are cleared before the error appears, so the previous result can never be copied by mistake.

What each pane does, how the array strategies differ and what the tool refuses to do

Objects, scalar values and conflicts

Objects are merged recursively and own keys are matched by name: a key that exists only in the overlay is added and logged as an add operation. Names such as __proto__, constructor and prototype are rejected on the overlay side, so a crafted document cannot reach the object prototype. Two different scalar values are settled by the rule you selected — the overlay value, the base value, or an error such as Merge conflict at $.service.retries.

Values of different types are not converted: a number under a key in one document and an array under the same key in the other count as a conflict and follow the same rule. Identical values are left untouched and produce no log entry, and two identical documents end with the single entry $: no changes.

Array strategies in practice

Replace array keeps the overlay array exactly as it is, even when the base array was longer. Concatenate arrays appends the overlay items after the base items without removing repeats, and Concatenate unique values drops repeated items by comparing their JSON representation, so ["a","b"] plus ["c","a"] becomes ["a","b","c"].

Merge objects by key matches items by the value of the key field: an overlay item with {id: 1} merges into the base item with id 1 instead of being appended, and the match compares the key as text, so 1 and "1" are the same identifier. Items without that key, and items that are not objects, are appended untouched. The key name is trimmed, so a leading or trailing space in the field is ignored.

Reading the result, privacy and limits

The result is plain JSON in the order the merge produced: base keys first, overlay additions after them. The operation log is the fastest way to audit a merge — every entry names the path it changed, and keyed array entries use the id form $.users[id=1].role. Copy puts the merged document on the clipboard and Download saves it as voritools-merged.json.

The merge runs entirely in the browser, with no upload and no network request, so the tool is safe for internal configuration and test fixtures. It does not resolve conflicts on its own and does not convert types; when a merge is ambiguous it obeys the rule you picked and records what it did.

Recent tools: