Developer tools

Compare JSON: the JSON Diff tool for exact changes

This tool compares two JSON documents and shows every value that was added, removed or changed, each at its exact JSON Pointer path. Paste JSON on each side, or choose a file on either side, then select Compare JSON. The comparison runs in your browser.

Paste JSON or choose a UTF-8 file.

Paste JSON or choose a UTF-8 file.

Comparison options

Arrays are compared by index. Duplicate keys are rejected.

Formatting and equivalent string escapes are ignored. Numeric values mode also ignores number spelling and the sign of zero.

Loading controls…

How to compare JSON documents

To compare two JSON documents, paste JSON into Original JSON and Changed JSON, set the comparison options, then select Compare JSON. The Results table lists every path that changed.

  1. Paste JSON into Original JSON and Changed JSON, or select Choose JSON file on either side to read a UTF-8 file instead; the filename or extension does not matter.
  2. Ignore object key order is on by default, so a reordered but equal object counts as no change. Turn it off to report key order too. Then choose Number comparison: Exact literals (the default) or Numeric values.
  3. Select Compare JSON. Cancel stops a long comparison; Load example fills both boxes with a short sample pair.
  4. Use Show to filter the Results table to All changes, Added, Removed or Changed, and Previous or Next to page through a long list. Copy report or Download report saves the complete comparison, including rows not shown on the current page.

Comparison rules

Numbers stay exact by default: 9007199254740993 is reported as changed against 9007199254740992, even though both round to the same value in ordinary floating-point math. Exact literals mode also distinguishes 1, 1.0 and 1e0 as different written values; Numeric values mode compares their decimal value instead, so those three compare equal to each other.

Array elements are compared by index, not by matching content, so inserting a value shifts every later index: the comparison reports each later index as changed, and the last one as added, even though only one value is genuinely new; the tool does not detect moves. Adding an object or array reports the container itself as added, together with each of its descendant paths. A key containing a slash or a tilde is escaped in its JSON Pointer path, as the format requires: a tilde becomes ~0 and a slash becomes ~1, so a key literally named a/b appears in a path as a~1b, not as two path segments.

What counts as equal

Formatting differences never produce a change: pretty-printed and minified versions of the same document compare equal, and so do 2 documents with different indentation or line endings. Equivalent string escapes are also ignored, so a string written as "\u0041" and one written as "A" compare equal, since both decode to the same text. A single leading UTF-8 byte-order mark on either document is ignored as well, rather than treated as part of the content.

A duplicate key within one object is rejected outright, on either side, rather than silently keeping the last occurrence the way some JSON parsers do. JSON itself does not define which repeated key should win, and a JSON Pointer path has no way to address one occurrence over another, so the comparison reports a duplicate-key error naming the affected side instead of guessing.

Limits

This tool sets no size or depth limit. Your browser sets two: its memory, and its call-stack depth for deeply nested input. JSON nested several thousand levels deep can stop with the message that the browser could not finish, and a file too large to read as text stops with a text-size error. A very large or very different pair of documents can also simply take longer to compare than two small, similar ones, and Cancel stops the comparison at any point; comparing a smaller section of a large document is the fallback if a full comparison does not finish.

The Results table shows 50 changes at a time; use Previous and Next to page through the rest. The count of Added, Removed and Changed rows above the table always reflects the complete result, not just the visible page.

Questions

What is the difference between {} and [] in JSON?

{} is an empty object and [] is an empty array; JSON treats them as different types even though both are empty. This comparison reports a value's type alongside its path, so changing an empty object to an empty array at the same path shows as a changed value, not as no change.

How to do JSON compare?

Both sides must be valid JSON: comments and trailing commas are rejected, and empty input is rejected too. Beyond that, paste or choose a file for each side and select Compare JSON; the two documents are parsed independently, so neither needs to resemble the other in size or formatting.

Can I compare JSON files instead of pasting text?

Yes. Choose JSON file on either side reads a UTF-8 file directly, regardless of its filename or extension; a .txt file containing JSON works the same as a .json file. Objects, arrays and single scalar values are all accepted as a document's root.

Can I ignore key order when comparing JSON?

Yes, and it is on by default: an object counts as equal to a reordered version of itself when every key and value still matches. Turn it off to report key order too. The object's own path then shows as changed when its keys are reordered, added or removed.

Does the comparison care whether a number is written as 1 or 1.0?

It depends on the Number comparison setting. Exact literals mode treats 1, 1.0 and 1e0 as different written values and reports a change between them. Numeric values mode compares their decimal value instead, so those three, along with -0 and 0, all compare equal.

Can I compare more than 2 JSON documents at once?

No. Each comparison takes exactly one original and one changed document; there is no three-way or batch comparison mode. To compare several documents against a shared baseline, run this tool once for each pair, using the same baseline document as Original JSON each time.

Does it catch duplicate keys in a JSON object?

Yes. A duplicate key anywhere in either document is rejected before comparison begins, with an error naming the affected side, rather than silently keeping one occurrence and discarding the other the way some JSON parsers do when they encounter the same key twice.

Can I export the full list of changes?

Download report and Copy report are both available, and each produces a JSON report listing every change, not only the ones visible on the current results page. The report also includes the options you chose and the full text of both documents.

Are my files uploaded?

No. The comparison runs in your browser tab, in a Web Worker. Compare JSON loads only this tool's own code from the site, and your pasted text or chosen files are not sent anywhere. Copy and download happen only when you select them.