Original
Changed
Empty Runs in your browser

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

  1. 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.
  2. The differences appear below the editors as you type. With Live off, press Compare or Ctrl+Enter.
  3. Read the List tab for every change with its path, or the Visual tab to see the changes in place inside the document.
  4. 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:

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

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.

Frequently asked questions

How do I compare two JSON files?

Paste or open the original JSON on the left and the changed JSON on the right. Every difference is listed below with its path and the old and new values.

Does key order matter when comparing JSON?

No. The comparison is structural, so objects with the same keys and values in a different order are identical. Formatting and whitespace are ignored too.

How are arrays compared?

By position by default. Set Match arrays to a field such as id to match items by that field, so an inserted or reordered item is reported once instead of making every later item look changed.

Can I get the differences as a JSON Patch?

Yes. Copy JSON Patch copies an RFC 6902 patch that turns the original document into the changed one.

Is this better than a text diff?

For JSON, usually yes. A text diff reports changes when keys move or indentation differs. A JSON diff reports only real changes in the data.

Editor settings

Type

{
  "id": 1024, "name": "Ada", "active": true,
  "tags": ["0O", "1lI", "=> != >="], "manager": null
}

Colour theme

Code editor

Defaults

Send feedback

How is online-json working for you?