Skip to content

JSON Compare (Diff)

Paste two JSON documents and get a structural diff rather than a line-by-line one. Reordered keys and different indentation are not differences; changed values, new keys, and missing keys are, each reported with a JSONPath. Nothing leaves your browser.

Loading editor...
Paste left and right JSON
Loading editor...
Differences
Auto-run ON

How to compare two JSON documents

  1. Paste both documents into the left panel, either as one object with two keys, {"left": ..., "right": ...}, or as the first document, a line containing only ---, then the second.
  2. The diff appears on the right as you type. The toast shows Identical or the number of differences.
  3. Tick Ignore array order when arrays are really sets (tags, permissions) and reordering should not count.
  4. Click Copy or Download .txt to paste the report into a ticket or pull request.

Either side can be any JSON value. If one fails to parse, the error bar says why; click Fix to repair it.

What the output looks like

Input:

{
  "left": {"id": 7, "name": "Widget", "price": 9.5, "tags": ["new", "sale"], "stock": 12},
  "right": {"id": 7, "name": "Widget Pro", "price": 10, "tags": ["sale", "new"], "sku": "W-7"}
}

Output:

4 changed, 1 added, 1 removed

~ $.name: "Widget" -> "Widget Pro"
~ $.price: 9.5 -> 10
~ $.tags[0]: "new" -> "sale"
~ $.tags[1]: "sale" -> "new"
- $.stock: 12
+ $.sku: "W-7"

The first line is the summary. Each line after it is one difference: ~ for a changed value, + for a key or element only on the right, - for one only on the left. Paths are JSONPath, so $.tags[0] is the first element of the top-level tags array. Values over 80 characters are shortened with ....

With Ignore array order ticked, the two tags lines disappear and the summary becomes 2 changed, 1 added, 1 removed.

What counts as a difference

  • Key order never does: {"a": 1, "b": 2} and {"b": 2, "a": 1} are identical.
  • Whitespace and indentation never do, because both sides are parsed first.
  • Type changes do, and the line says so: ~ $.id: "7" -> 7 (string -> number).
  • null versus a missing key does; see JSON null vs undefined.
  • Without the option, arrays are compared by position, so inserting an element at the front reports every later one as changed.

Limits and notes

  • Files up to 5 MB for both sides together. Everything runs as JavaScript in your browser; nothing is uploaded.
  • The report is for reading, not for applying. For a machine-readable format, see JSON Patch and JSON Merge Patch.
  • There is no "moved" marker; a moved element shows as a change, or as a removal plus an addition with the option on.
  • Numbers are compared after parsing, so 1.0 and 1 are equal, and integers above 2^53 may lose precision first.
  • For command-line and scripted approaches, see how to compare two JSON files.

Frequently Asked Questions

How do I paste two documents?
Either paste one object with two keys, {"left": ..., "right": ...}, or paste the first document, then a line containing only ---, then the second. The first key or document is treated as the left side.
Does key order count as a difference?
No. Both sides are parsed first, so key order, indentation, and whitespace never show up. Only values, types, and the presence or absence of keys are compared.
What does Ignore array order do?
It compares arrays as multisets instead of position by position. ["new", "sale"] and ["sale", "new"] then count as equal, and only elements present on one side are reported, with the path $.tags[].
Is a missing key the same as null?
No. A key set to null on one side and absent on the other is reported as added or removed, not as changed. Some APIs treat the two alike, but the diff keeps them distinct.
Can I apply the diff automatically?
The output is a readable report for humans, not a JSON Patch document. If you need a machine-applicable patch, generate one with a JSON Patch library; the report is still useful for review.
Is my data uploaded?
No. Parsing and comparison run as JavaScript in your browser tab, so neither document leaves your machine.

Guides that go with this tool

More JSON tools

JSON Viewer (Tree View)

Explore any JSON document as a collapsible tree in your browser. Click a key to copy its JSONPath, click a value to copy it, and page through large arrays without freezing the tab.

JSON Fixer: Repair Invalid JSON

Repair broken JSON in your browser. Strips markdown fences and prose, fixes trailing commas, single quotes, comments, unquoted keys, Python literals and unclosed brackets, and lists every problem it detected.

JSON to CSV Converter

Convert a JSON array of objects to CSV in your browser. Nested objects are flattened to dotted columns, values are quoted correctly, and Excel-friendly output is one click away.

CSV to JSON Converter

Convert CSV with a header row into a JSON array of objects in your browser. Numbers and booleans are detected, leading-zero codes stay strings, and the delimiter is picked up automatically.

JSON to YAML Converter

Convert JSON to clean YAML in your browser with 2, 3 or 4 space indentation. Strings that a YAML parser would read as numbers, booleans or dates are quoted so they survive the round trip.

YAML to JSON Converter

Convert YAML to JSON in your browser. Multi-document files become an array, anchors and aliases are resolved, and only null, true, false and plain numbers are typed, so yes, NO and dates stay strings.

JSON to XML Converter

Convert JSON to XML in your browser. Choose the root and array item element names, nulls become xsi:nil, keys are sanitised into valid XML names, and text is escaped.

XML to JSON Converter

Convert XML to JSON in your browser. Attributes are kept as @_name keys, repeated tags become arrays, numbers and booleans are detected, and invalid XML reports the line and column.

JSONPath Query Tester

Test JSONPath expressions against your JSON in the browser. Pick an expression, see the matches as a JSON array with a count, and explore the results in tree view.

JSON Escape / Unescape

Escape text into a JSON string literal, unescape one back to plain text, or stringify a whole JSON document to embed it inside another JSON value or in source code.