FormatterHQ

JSON Diff – Compare JSON Online

Compare two JSON documents by structure, not by text. See every added, removed and changed value with its JSON path, while key order and formatting are ignored.

Loading tool…
Ready.

How to use the JSON Diff - Compare JSON

  1. Paste the original JSON on the left and the new JSON on the right, or load each side with Open file.
  2. Leave Semantic JSON ticked (untick and re-tick it after pasting) to format both sides with sorted keys, and tick Ignore case if letter case in string values should not count.
  3. Read the Semantic differences list under the editors: every added, removed and changed value with its JSON path. The editors above highlight the changed lines side by side.
  4. Step through the changed lines with Prev and Next, and use Copy above either side to copy that document.

Why a JSON diff is different from a text diff

Two JSON documents can be identical in meaning but look completely different as text: keys in another order, different indentation, everything on one line. A plain text diff reports all of that as changes. This JSON diff parses both documents and compares their values, so you only see real differences, each labeled with its location as a JSON path.

Example

Left:  {"id":1024,"name":"Wireless Mouse","price":24.99,
        "tags":["usb","office"],"stock":{"warehouse":12}}
Right: {"name":"Wireless Mouse","id":1024,"price":22.49,
        "tags":["usb","office","sale"],"stock":{"warehouse":12,"store":3}}
Semantic differences (3)

~ $.price  24.99 → 22.49
+ $.tags[2]  "sale"
+ $.stock.store  3

The swapped id and name keys are not reported, because object key order has no meaning in JSON.

Reading the paths

  • $ is the root of the document.
  • .name is an object key; keys with special characters appear as ["content-type"].
  • [2] is an array index, starting at 0.
  • + means added, − removed and ~ changed. A change of type, such as "42" to 42, is reported as changed.
  • Long values are shortened to 100 characters, and the list shows at most 500 entries while its heading gives the full count.

Options explained

  • Semantic JSON (on by default) – rewrites both sides with a two-space indent and keys sorted alphabetically at every level, so the highlighted lines in the two editors are not disturbed by formatting or key order. Files you open and the sample are rewritten automatically; after pasting or typing, untick and re-tick the box to rewrite both sides. Text that does not parse is left as typed.
  • Ignore case – compares string values case-insensitively in the list, so "Admin" equals "admin", and ignores letter case in the line view. Key names stay case-sensitive in the list.
  • Ignore whitespace – applies to the line view only, where indentation and runs of spaces no longer count as changes. The list of semantic differences never depends on formatting.
  • View – besides the list of differences, the editors show both documents Side by side or Unified with changed lines highlighted, and Collapse unchanged folds long stretches without changes.

Two rules are fixed. Object key order is always ignored in the list, and arrays are always compared position by position: ["a","b"] and ["b","a"] are reported as two changed items, and an item inserted at the start of an array shifts every element after it. There is no option to ignore array order, so sort lists of tags or IDs the same way on both sides before comparing.

Strict parsing

Both sides must be strict JSON. Comments, trailing commas, single quotes and unquoted keys are not accepted: the header of that side shows Invalid JSON with the line number, the status bar gives the parser message, and the list of differences stays hidden until both sides parse. Fix the input first; the JSON validator and JSON fixer help with that.

Numbers, nulls and missing keys

Values are compared exactly as JSON defines them. 1 and 1.0 parse to the same number and are equal, while null and a missing key are different: a key that exists with a null value on one side and is absent on the other is reported as added or removed. Very large integers beyond about 9 × 1015 lose precision when parsed in JavaScript, so two IDs that differ only in their last digits may compare as equal; compare such values as strings if that matters.

When to use a JSON diff

  • API testing – compare a response against the expected fixture, or the same endpoint in staging and production.
  • Configuration – see what changed between two versions of package.json, tsconfig.json or a feature-flag file.
  • Data migrations – verify that exported records match after a transformation.
  • Debugging – find which field differs between a working and a failing request payload.

For large documents, format them first with the JSON formatter if you also want to read them. Both documents are compared in your browser and never uploaded.

Frequently asked questions

Does key order matter in a JSON comparison?
No. JSON objects are unordered, so keys are matched by name and a reordered object is never listed as a difference. With Semantic JSON ticked, both sides are also rewritten with sorted keys, so the highlighted lines ignore key order too.
How are arrays compared?
Element by element in order, so an inserted item shifts the rest and every shifted position is listed as changed. There is no option to ignore array order; sort both arrays the same way first if their order does not matter.
Can I compare JSON with comments or trailing commas?
Not directly. Both sides are parsed as strict JSON, so comments, trailing commas, single quotes and unquoted keys are reported as Invalid JSON with the line number. Clean the input with the JSON fixer first, then compare.
Is "42" equal to 42?
No. A string and a number are different types in JSON, so the value is reported as changed. This catches common serialization bugs.
Is my JSON sent to a server?
No. Parsing and comparison happen entirely in your browser.

Last updated October 3, 2026

Guides

Related tools

Diff Checker - Compare Text Compare two texts side by side and highlight every added, removed and changed line and word. Free online diff checker. File Diff - Compare Files Compare two files online and see line-by-line differences side by side or in a unified view, with the changed characters highlighted. XML Diff - Compare XML Compare two XML documents after normalising indentation and line breaks, and highlight changed elements side by side. Base64 to JSON Decode a Base64 string back to JSON, validated and pretty-printed. Compare PDF Compare the text of two PDFs and see every added, removed and changed sentence side by side. Ignores line breaks. No upload. Compare CSV Files Compare two CSV files by key column or row position: see added, removed and changed rows with old and new values, then export the differences. CSV to JSON Converter Convert CSV to JSON online for free. Get formatted JSON with types detected automatically. .env to JSON Converter Convert .env (dotenv) files to JSON: handles quotes, export, comments, multi-line values and ${VAR} expansion. Excel to JSON Converter Convert Excel to JSON online for free. Get formatted JSON with types detected automatically. HTML Table to JSON Converter Convert HTML to JSON online for free. Get formatted JSON with types detected automatically. INI to JSON Converter Convert INI configuration files (php.ini, .gitconfig, setup.cfg style) to JSON with sections, arrays and typed values. jq Playground Run jq filters on JSON in your browser with real jq 1.8: live output, -r -c -s -n -S and --arg options, clear errors and a clickable cheat sheet.