waynetools

JSON Diff Tool — Compare JSON & Generate JSON Patch / Merge Patch

Paste two JSON documents to see a semantic diff — added, removed and changed keys with exact paths, ignoring key order — then copy a ready-to-apply RFC 6902 JSON Patch or RFC 7386 JSON Merge Patch. Runs 100% in your browser; nothing is uploaded.

Updated 2026-07-11 · Built by Wayne

Client-side only Ignores key order Array-order-agnostic mode JSON Patch RFC 6902 JSON Merge Patch RFC 7386
Paste JSON on both sides (or use "Load sample") and click Compare JSON.
[]
{}

What this tool does

This is a free, browser-only JSON diff tool that compares two JSON documents by value instead of by text, so key order never causes a false difference. It reports every addition, removal and change with its exact JSON Pointer path, then converts that diff into two output formats you can use immediately: an applicable JSON Patch (RFC 6902) operation list, and a JSON Merge Patch (RFC 7386) object. Turn on "ignore array order" to treat arrays as unordered sets when comparing API responses whose ordering is not guaranteed.

How to use it

Paste your original JSON into the LEFT box and the updated JSON into the RIGHT box, or click "Load sample" on each side to see it work instantly. Click Compare JSON. The diff list below shows each change tagged ADD, REM, or CHG with its path. The two panels at the bottom fill in with a ready JSON Patch array and a JSON Merge Patch object — click Copy or Download on either one.

Example 1 — nested config with a value change and a rename

Input — LEFT

{
  "service": "checkout",
  "timeoutMs": 3000,
  "retries": 2,
  "flags": { "newUi": false }
}

Input — RIGHT

{
  "service": "checkout",
  "timeoutMs": 5000,
  "flags": { "newUi": true, "darkMode": true }
}

Output — diff

CHG /timeoutMs: 3000 → 5000
REM /retries: 2
CHG /flags/newUi: false → true
ADD /flags/darkMode: true

Output — JSON Patch (RFC 6902)

[
  { "op": "replace", "path": "/timeoutMs", "value": 5000 },
  { "op": "remove", "path": "/retries" },
  { "op": "replace", "path": "/flags/newUi", "value": true },
  { "op": "add", "path": "/flags/darkMode", "value": true }
]

Output — JSON Merge Patch (RFC 7386)

{
  "timeoutMs": 5000,
  "retries": null,
  "flags": { "newUi": true, "darkMode": true }
}

Example 2 — array with reordering (ignore array order ON)

Input — LEFT

{ "roles": ["viewer", "editor", "admin"] }

Input — RIGHT

{ "roles": ["admin", "viewer", "billing"] }

Output — diff with "ignore array order" OFF (positional)

CHG /roles/0: "viewer" → "admin"
CHG /roles/1: "editor" → "viewer"
CHG /roles/2: "admin" → "billing"

Output — diff with "ignore array order" ON (multiset)

REM /roles: "editor"
ADD /roles: "billing"

JSON Patch vs. JSON Merge Patch

JSON Patch (RFC 6902) is an ordered array of explicit add/remove/replace operations, each with a precise JSON Pointer path. It can express any transformation, including inserting into the middle of an array, and it composes well with test operations for safety checks. JSON Merge Patch (RFC 7386) is a smaller, more human-readable partial document: you deep-merge it into the original, keys set to null delete that field, and arrays are replaced wholesale rather than diffed element by element. Use Merge Patch for simple object updates (config files, feature flags); use JSON Patch when you need array precision or an audit trail of exact operations.

FAQ

What makes this JSON diff semantic instead of textual?

A textual diff compares two JSON strings line by line, so reformatting whitespace or reordering object keys shows up as a change even though the data is identical. This tool parses both documents into real JSON values first and compares those values structurally, so {"a":1,"b":2} and {"b":2,"a":1} are correctly reported as equal. Only real additions, removals, and value changes are shown.

Does it ignore the order of items inside arrays too?

By default, arrays are compared positionally (index by index) since order is often meaningful, for example an ordered list of steps. Turning on "Ignore array order" switches to a multiset comparison: it matches array elements regardless of position and only reports items that were truly added or removed, which is useful when comparing API responses whose array order is not guaranteed.

What is the difference between JSON Patch and JSON Merge Patch?

JSON Patch (RFC 6902) is an ordered list of explicit operations — add, remove, replace — each targeting an exact JSON Pointer path; it can express any transformation including array insertions. JSON Merge Patch (RFC 7386) is a simpler partial JSON document that you deep-merge into the original: keys present become their new value, keys set to null are deleted, and whole arrays are replaced wholesale rather than diffed. Merge Patch is easier to read for small object changes; JSON Patch is more precise, especially for arrays.

Is the generated JSON Patch actually applicable, not just a description?

Yes. The tool builds the patch by walking the same diff it displays and emits real add/remove/replace operations with correctly encoded JSON Pointer paths (escaping ~ as ~0 and / as ~1). Applying the generated patch operations to the left-hand JSON in order reproduces the right-hand JSON exactly, which you can verify with any RFC 6902 compliant patch library.

Does this tool upload my JSON anywhere?

No. Parsing, diffing, and patch generation all run in plain JavaScript in your browser. There is no server call, no analytics on your input, and no network request after the page loads. It keeps working with the network disconnected, which makes it safe for comparing production configs, secrets-bearing payloads, or customer data you cannot send to a third-party server.

Can I use this to compare two versions of a config file or API response?

Yes, that is the main use case: pasting an old and a new config, environment variable set, feature-flag payload, or API response body to see exactly what changed, get a human-readable summary, and export a patch your deploy pipeline or a colleague can apply directly instead of hand-editing the diff.

More tools