Skip to main content

JSON Diff

Compare two JSON documents and list what changed.

Original

Ln 1, Col 1
JSON

Changed

Ln 1, Col 1
JSON

Result

Your result will appear here

Add JSON to both inputs above, then choose Compare.

Waiting for input

Compare two JSON documents by structure, ignoring key order, and see every added, removed and changed path in one list.

What is JSON Diff?

JSON Diff is a free online tool that compares two JSON documents by structure, in your browser, and lists every value that was added, removed or changed, each with its path. The order of the keys does not matter, and 1, 1.0 and 1e0 count as the same number.

Use it to see what changed between two API responses, two configuration files or two versions of the same data, without the noise of reformatting.

What it supports

  • Two JSON documents of any kind: an object, a list, a text, a number, true, false or null can be the top level.
  • Objects are compared by key, so the order of keys is ignored, and the list of differences is sorted by key.
  • Lists are compared by position: item 0 with item 0, item 1 with item 1, and so on. An item that exists in only one list is reported as added or removed at its position.
  • Numbers are compared by their exact decimal value, with no rounding: 1, 1.0 and 1e0 are equal, -0 equals 0, and 9007199254740993 differs from 9007199254740992. Texts are compared by their value, so "\u0041" and "A" are equal.
  • Each difference is one line: + path: value for an added value, - path: value for a removed one, and ~ path: before -> after for a changed one. A value that is an object or a list is written compact, on the same line.
  • Paths are JSON Pointers (RFC 6901) after a #: #/a/b is the member b of a, #/tags/1 is item 1 of tags, and # alone is the whole document. A / in a key is written ~1 and a ~ is written ~0.
  • A value whose type changed, such as a number that becomes a text, or an object that becomes a list, is one change at its path. The tool does not look inside it.

Good to know

  • List order matters. Two lists with the same items in another order are reported as changes at every position that differs. There is no “moved” and no matching of items by an id.
  • A name repeated inside one object, or a string with an unpaired surrogate escape, is refused in either input instead of letting one value win.
  • The comparison is of data, not of text: spaces, indentation and escapes such as \u0041 are not differences. When you need those, use a text diff tool.
  • Values are shown as they are written in the source, so 1.50 appears as 1.50 in the list even though it equals 1.5.
  • A list of differences that would pass the size limit is refused with an incomplete preview (see below).

How do I use JSON Diff?

  1. Paste or type the first JSON document in “Original” and the second one in “Changed”. Nothing runs while you type.
  2. Press “Compare”.
  3. Read the result next to your inputs: it says how many differences were found, then lists one line per difference, with the path where it happens. If the two documents have no differences, the result says so. If either input cannot be used, the message names it and gives the line and column.
  4. Press “Copy” to put the list on your clipboard, or “Download” to save it as differences.txt.

Examples

Added, removed and changed

Put the first document in “Original”, the second in “Changed” and press “Compare”. Each line starts with a sign: - for a value only the original has, + for a value only the changed document has, and ~ for a value in both with different content. The keys of the second document are in another order, which makes no difference, and the list is sorted by key. #/tags/1 is the item at position 1 of tags, counting from 0.

{
  "name": "Ada",
  "age": 36,
  "tags": [
    "math"
  ],
  "city": "London"
}
{
  "city": "London",
  "name": "Ada Lovelace",
  "tags": [
    "math",
    "poetry"
  ],
  "email": "ada@example.com"
}
- #/age: 36
+ #/email: "ada@example.com"
~ #/name: "Ada" -> "Ada Lovelace"
+ #/tags/1: "poetry"

A syntax error in one input

The “Changed” document has a comma before its closing brace, which JSON does not allow. The tool refuses, names the input that is wrong and gives the line and column. Nothing is compared until both documents are valid.

{"a": 1}
{"a": 1,}

JSON does not allow a comma before a closing brace or bracket (trailing comma).

Line 1, column 9

The same data, written differently

The keys are in another order, and 10 is written as 1e1 and 2 as 2.0. Numbers are compared by their exact value and the order of keys does not count, so the tool reports no differences.

{"price": 10, "qty": 2}
{"qty": 2.0, "price": 1e1}

The two JSON documents are identical.

Lists are compared by position

The two lists hold the same items in another order. Items are compared position by position, so the tool reports two changes, at #/0 and #/1, not a move.

["a", "b"]
["b", "a"]
~ #/0: "a" -> "b"
~ #/1: "b" -> "a"

Keys with a slash

A key that contains / is written with ~1 in the path, and ~ with ~0, as RFC 6901 requires, so a path is never ambiguous. Here the key is a/b.

{"a/b": 1}
{"a/b": 2}
~ #/a~1b: 1 -> 2

Limits and privacy

Size limits

  • Input: each box takes up to 2,000,000 bytes of UTF-8 text (about 2 MB), counted separately. Accented letters and emoji take more than one byte each. Larger input is rejected.
  • Result: also up to 2,000,000 bytes. If the complete result would be larger, the tool shows only an incomplete preview of the first 100,000 bytes, and that preview cannot be copied or downloaded.
  • Nesting: up to 256 levels of objects and lists inside each other. Deeper JSON is refused because it is beyond what the tool processes.
  • Time: a run that takes longer than its time limit is stopped. Try a smaller input.

Is my text sent to a server?

No. The text you type or paste, or open from a local file, is processed locally in your browser, in a dedicated Web Worker. It is never uploaded or sent to the server (a file you open is read in your browser only), and it is not written to storage, cookies or the address bar.

“Copy” puts the result on your clipboard and “Download” saves it as a file, but only when you press the button. The file is created in your browser, so nothing is uploaded.

For the full details, see the Privacy Policy

Related tools and pages

Your text stays in the page when you switch tools in the same tab, so you can try the same text in another tool. Reloading or closing the tab ends it.

All tools