Code and data

JSON diff

Paste two JSON documents to see what really changed, with key order ignored, exact numbers, JSON Pointer paths, a side-by-side view and a JSON Patch.

Both documents are compared in this tab. They are not uploaded, not saved and never put in the page address.

Options

Paste or open JSON on both sides.

    Changes

      Side by side

      JSON Patch (RFC 6902)

      Applied in order, it turns the left document into the right one. Ignored paths are left out.

      Runs in your browser. Nothing you type or open is uploaded. Free to use, no account. More code and data tools

      How to compare two JSON files

      1. Paste the original on the left and the changed version on the right, or open the files. The comparison updates as you type.
      2. Read the change list: every addition, removal and changed value with its JSON Pointer path, such as /dependencies/esbuild or /items/3/price.
      3. Scan the side-by-side view for context: removed lines are marked on the left, added lines on the right, and changed values on both.
      4. Copy the JSON Patch to apply the same change in code, or to store a compact record of what changed.

      Why a JSON diff instead of a text diff

      A text diff sees every reordered key, re-indented block and changed line ending as a difference. JSON objects are unordered by definition, so {"a":1,"b":2} and {"b":2,"a":1} are the same data. This tool parses both sides and compares values: keys in any order, any whitespace, and numbers by value, so 1.0 equals 1 unless you switch that off.

      For prose, logs or code that isn't JSON, use text compare instead. To tidy a single document first, use the JSON formatter.

      Options

      • Ignore key order is on by default. Turn it off to also report objects whose keys were reordered, which matters for signed payloads and snapshot files.
      • Ignore array order treats arrays as sets: [1,2,3] equals [3,2,1]. Use it for tag lists and permission arrays, not for ordered data.
      • Ignore paths skips volatile fields such as timestamps, ETags and request IDs. /items/*/updatedAt matches that field in every item, **/etag at any depth, and a plain dotted name like meta.updatedAt works too.

      Arrays, numbers and duplicate keys

      Arrays are aligned by their longest common sequence, so inserting one item near the start shows one addition, not a change to every item after it. When an item is edited rather than replaced, the list shows the fields that changed inside it.

      Numbers are compared exactly as written. JavaScript's JSON.parse rounds integers above 2^53, so IDs like 12345678901234567891 would look equal to their neighbours in many online tools; here they don't. A key that appears twice in one object is reported, because parsers disagree about which copy wins.

      JSON Patch output

      The patch follows RFC 6902: a list of add, remove and replace operations with JSON Pointer paths. Array indexes in the patch refer to the document as it is at that step, which is how RFC 6902 applies operations, so a standard JSON Patch library applies it as it is. This page's patches are tested with the jsonpatch library for Python on real API responses.

      Private by design

      Privacy

      Both documents stay in this browser tab: they are parsed and compared here, in a background worker for large files, and this tool doesn't send them anywhere. They are not saved and never go into the page address, so a link to this page doesn't contain your data. The options are remembered as settings.

      This page also shows Google ads, which can use cookies. Privacy and cookies explains how.

      Questions

      How do I compare two JSON files and ignore the order of keys?

      Paste or open both files here. Key order is ignored by default, because JSON objects are unordered, so only real changes to values are listed, each with its JSON Pointer path.

      Can it ignore the order of items in an array?

      Yes. Tick Ignore array order to compare arrays as unordered collections. Each item is matched with an identical item on the other side, and only unmatched items are reported.

      How do I skip fields like timestamps when comparing?

      Add their paths under Ignore paths, one per line, for example /meta/updatedAt or /items/*/etag. A star matches one level, two stars match any depth, and everything under an ignored path is skipped.

      What is a JSON Patch?

      A JSON Patch (RFC 6902) is a JSON array of operations, such as add, remove and replace, that turns one document into another. Copy the patch from this page to apply the same change in code.

      How large can the files be?

      Several megabytes compare in a second or two in a current browser; large inputs run in a background worker so the page stays responsive. The side-by-side view switches off for very long documents, while the change list and the patch still work.

      From the same developer