Resell services with the EthicalSMM API

JSON Diff Checker

Compare two JSON documents and list every added, removed and changed value by its path, ignoring key order and formatting.

Was this tool helpful?

Thanks for the feedback!

This tool compares two JSON documents and lists every value that was added, removed or changed, each with its exact path. It reads the data rather than the text, so different key order, spacing and line breaks do not show up as differences. It is useful for developers and testers comparing API responses, config files or translation files, and the comparison runs in your browser, so nothing is uploaded.

How to use it and how to read the result

Paste the older version into Original JSON and the newer one into Changed JSON, then press Compare JSON. Each line of the result starts with a symbol:

  • + a key or array item that exists only in the changed JSON
  • - a key or array item that exists only in the original
  • ~ a value that is in both but different, shown as old → new

Counters for Added, Removed and Changed appear above the result. Paths start at $, which stands for the whole document. Simple key names are joined with a dot, such as $.address.city. Keys with hyphens, spaces or a leading digit are written in brackets, such as $["order-id"], and array positions look like $.skills[2]. Very long values are cut to 120 characters with an ellipsis so the list stays readable.

How the comparison works

The tool walks both documents together. When both sides are objects, it takes every key found in either one, sorts them alphabetically and compares key by key, so the result does not depend on the order keys were written in. When both sides are arrays, it compares item 0 with item 0, item 1 with item 1 and so on. For anything else it compares the exact JSON value, which means a number and a string are different even if they look alike.

Worked example

Original:

{"id":101,"name":"Asha","city":"Pune","skills":["SQL","Python"],"active":true}

Changed:

{"id":101,"name":"Asha","city":"Bengaluru","skills":["SQL","Python","Go"],"salary":1250000}

Result, with Added 2, Removed 1, Changed 1:

- $.active: true
~ $.city: "Pune" → "Bengaluru"
+ $.salary: 1250000
+ $.skills[2]: "Go"

The unchanged id and name are not listed. If the two documents hold the same data, you see "No differences: both documents hold the same data (key order is ignored)."

Edge cases worth knowing

  • Arrays are compared by position. Removing the first item of [1,2,3] to get [2,3] shows ~ $[0]: 1 → 2, ~ $[1]: 2 → 3 and - $[2]: 3. If order does not matter in your list, sort both arrays the same way before comparing.
  • Type changes count as changes: {"a":1} against {"a":"1"} gives ~ $.a: 1 → "1". This catches APIs that start sending numbers as strings.
  • If a whole object is replaced, for example {"a":{"b":1}} becoming {"a":5}, you get one line, ~ $.a: {"b":1} → 5, instead of a list of removed keys.
  • Invalid JSON is reported per box. A missing quote in the second box gives a message starting "The changed JSON is not valid:" followed by the browser's description of where parsing failed.

Where it helps, and related tools

A few everyday jobs where a path-by-path list beats reading two files side by side:

  • Checking what an API returns before and after a release, so you can see a renamed or dropped field before a mobile app breaks on it.
  • Comparing the settings file on a staging server with the one on production.
  • Finding keys missing from a translation file. Values in en.json and hi.json will all differ, but the + and - lines show exactly which keys exist in only one file.
  • Reviewing a change to a large fixture or mock file in a pull request.

To check or tidy a document before comparing, use the JSON validator. To see a full side-by-side view with keys in the same order, run both files through the JSON key sorter first.

Frequently asked questions

How do I compare two JSON files online?
Paste the first file into Original JSON and the second into Changed JSON, then press Compare JSON. The tool lists each added, removed and changed value with its path, and the files never leave your browser.
Does key order matter when comparing JSON?
No. RFC 8259 defines a JSON object as an unordered collection of name/value pairs, and this tool sorts keys before comparing, so reordered keys are not reported as changes.
Why does removing one array item show several changes?
Arrays are compared position by position. Removing an early item shifts every later item down by one, so each shifted position is reported as changed and the last one as removed.
Is the number 1 the same as the string "1" in a JSON diff?
No. They are different JSON types, so the tool reports a change such as ~ $.a: 1 → "1". This is useful for spotting APIs that change a field type.
What does the $ mean in the diff paths?
The $ stands for the root of the document, as in JSONPath. $.city is the city key at the top level and $.skills[2] is the third item of the skills array.
Can I compare minified JSON with formatted JSON?
Yes. Both are parsed into data before comparing, so spaces, indentation and line breaks make no difference to the result.

Related guides

Related tools

People also used

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.