JSON Diff & Compare
Paste an original and a changed JSON document to see exactly what differs: each added, removed or changed value is listed with its path, old and new value. The comparison is semantic, so key order and number formatting don't count as changes. Both documents are compared in this page and never sent anywhere.
Key order never matters, and 1, 1.0 and 1e0 are the same number.
Click a count to hide or show that kind of difference.
JSON Patch (RFC 6902) — 0 operations
Applying these operations in order to Original produces Changed. Array indices in the patch account for the earlier operations, so they can differ from the indices shown in the list. With an Ignore option ticked, the result matches Changed apart from the ignored order or whitespace.
How to use
- Paste the original JSON into the left box and the changed JSON into the right one, or click Load sample.
- Tick Ignore array order if the order of list items doesn't matter, or Ignore whitespace in strings to skip spacing-only edits.
- Click Compare (or press Ctrl+Enter). If either side isn't valid JSON, the status line names the side, line and column and the cursor jumps there.
- Read the list: each row shows the kind of change, the path (as $.a.b[0] and as a JSON Pointer) and the old → new value. Click a count to hide or show that kind.
- Copy the differences as text, or copy or download them as an RFC 6902 JSON Patch that turns the original into the changed document.
Examples
{"version": "1.4.0", "private": true, "tags": ["json", "diff"], "deprecated": null}{"version": "1.5.0", "private": "true", "tags": ["json", "compare", "diff"]}changed $.version "1.4.0" → "1.5.0" type changed $.private true → "true" added $.tags[1] "compare" removed $.deprecated was null
[
{"op": "replace", "path": "/version", "value": "1.5.0"},
{"op": "replace", "path": "/private", "value": "true"},
{"op": "add", "path": "/tags/1", "value": "compare"},
{"op": "remove", "path": "/deprecated"}
]Supported formats
- Strict JSON (RFC 8259) on both sides: objects, arrays, strings, numbers, true, false and null at any top level.
- Output: a readable list of differences, a plain-text report, and a JSON Patch (RFC 6902) array of add, remove and replace operations with JSON Pointer (RFC 6901) paths.
Privacy
This tool runs entirely in your browser. Nothing you enter or open is sent anywhere. Privacy policy.
Limitations
- Arrays are aligned by finding the smallest set of insertions and deletions. If two arrays need more than 2,000 insertions and deletions, items are compared by position instead, so a shifted list shows more changes than strictly necessary.
- With Ignore array order, arrays are compared as multisets: an item that changed in any way is reported as one removal plus one addition rather than field by field, because there is no key to match items on.
- Moved values are reported as a removal and an addition; the patch never uses move or copy operations.
- Numbers are compared after JavaScript parses them, so integers beyond 2^53 or decimals with more than about 17 significant digits can look equal when they are not. Duplicate keys keep only their last value.
- Only the first 1,000 differences are listed on screen; the copied report and the JSON Patch always contain all of them. Documents nested more than 1,000 levels deep are refused with a message.
FAQ
Does the order of keys matter?
No. JSON objects are unordered, so {"a":1,"b":2} and {"b":2,"a":1} are reported as identical. Array order does matter unless you tick Ignore array order.
What is the difference between "changed" and "type changed"?
Changed means the value kept its JSON type but has a new value, such as 30 becoming 45. Type changed means the type itself differs, such as true becoming "true", or null becoming 0, which often points to a serialisation bug.
How is a null value different from a missing key?
They are treated as different: {"a": null} compared with {} reports a removed key a whose old value was null. Many APIs treat the two differently, so the diff doesn't hide it.
Why do the patch indices differ from the list?
In the list, removed and changed items use their index in the original document and added items their index in the changed one. A JSON Patch is applied one step at a time, so its indices account for the items inserted or removed by earlier operations.