JSON Compare - Diff Two JSON Files Online
Paste two versions of a JSON document to see exactly what changed. Every added, removed and changed value is listed with its path, key order is ignored, and arrays can be matched by an id field instead of position.
How to compare two JSON documents
- Paste the original JSON on the left and the changed JSON on the right. You can also open or drop a file onto either side.
- The differences appear below the editors as you type. With Live off, press Compare or Ctrl+Enter.
- Read the List tab for every change with its path, or the Visual tab to see the changes in place inside the document.
- Use Copy JSON Patch to copy the differences as a JSON Patch (RFC 6902) that turns the original into the changed version.
A structural diff, not a text diff
A plain text diff reports a change whenever keys move or the indentation differs, even if the data is identical. This tool parses both sides and compares the values, so:
- Key order does not matter:
{"a":1,"b":2}and{"b":2,"a":1}are identical. - Whitespace and formatting do not matter, so you can compare minified JSON with pretty-printed JSON.
- Types do matter:
1and"1"are reported as a change.
Each difference is listed as added, removed, changed or moved, with a path such as $.order.items[2].qty and the values before and after.
Comparing arrays
By default, array items are matched by position. That works for lists such as coordinates, but it gives a misleading answer when an item is inserted at the top of a list of records: every following item looks changed. Set Match arrays to a field such as id, _id, key, name or uuid, and items are matched by that field instead. Inserted and deleted records are then reported as one addition or removal, and reordered records are reported as moves.
Useful for
- Checking what changed between two API responses, before and after a deploy.
- Reviewing changes to configuration files, feature flags or translation files.
- Writing test fixtures, or finding why a snapshot test fails.
- Producing a JSON Patch to send to an API that accepts PATCH requests.
Other tips
Swap sides exchanges the two sides. In the Visual tab, Show unchanged toggles the parts of the document that are the same on both sides. Your last pair of documents is remembered in this browser if you have Remember last input turned on in Settings.
Private by design
Both documents are compared in your browser using the open-source jsondiffpatch library. Neither side is uploaded.