araç köşesi

JSON Compare: Differences Between Two JSON Documents

Compare two JSON documents field by field; every added, removed and changed value is listed with its path

Your data stays with you. Conversion happens inside the browser; nothing is sent to a server.

How it works

Paste the old JSON into the left pane and the new JSON into the right pane; the differences appear below straight away. If you prefer a single box, put a line containing only --- between the two documents. The sign at the start of each line tells you what happened: + a field was added, - a field was removed, ~ a value changed. In the sample, the price drops from 24.99 to 21.99, the seller's state is removed, "sale" is added to the tags, and the stock count is now wrapped in quotes; the result reads "~ $.price: 24.99 → 21.99", "- $.seller.state", "+ $.tags[2]" and "~ $.stock: 42 → \"42\"" with a type-change note. The order in which keys are written and any indentation differences are ignored. If only the order of a list changed, set "Order inside arrays" to "Does not matter" and identical items in a different order stop showing up. If one of the documents is broken, you are told which one and on which line of the box.

This tool is also known as json compare, json diff, compare two json files, json diff online, json difference checker, compare json objects.

What is JSONPath?

A JSON path is the address of a value inside a document. $ stands for the root, a dot opens a child field, and a number in square brackets picks an item from a list: $.seller.name is the name field of the seller object, $.tags[2] is the third tag (counting starts at 0). Keys containing spaces or hyphens are written as $["full name"]. Because every difference is reported with such a path, you never have to hunt for the change in a large document.

What is JSON diff?

A JSON diff compares two JSON documents as data and lists what was added, removed or changed. Unlike a line-based text diff, it ignores formatting, indentation and key order, but it does pay attention to the type of each value. Developers use it to see how an API response changed between versions, why two environments behave differently with their configuration files, or which records an export updated.

What is the difference between a JSON compare and a text compare?

A text compare treats both files as strings and compares them line by line, so a changed indentation or a different key order already shows up as a difference. A JSON compare first parses both documents into a tree and compares the values found at the same path; formatting is ignored, while type changes such as 42 becoming "42" are caught. Use a text compare for contracts, articles or plain text, and a JSON compare for API responses and configuration files.

Why a line-by-line diff misleads you on JSON

Ordinary text diff tools compare lines. The same JSON can come out of one program with keys sorted alphabetically and out of another in insertion order; one may be minified onto a single line and the other pretty-printed. A line diff reports hundreds of differences although the data is identical. This tool first turns both documents into a tree, then compares the values that sit at the same path, so formatting never reaches the result.

The opposite problem is a number that became a string: 42 and "42" look almost the same on screen, but the program reading the JSON expects a number for one and text for the other. The tool adds the type change at the end of the line (number → string).

  • {"a":1,"b":2} vs {"b":2,"a":1} → no difference
  • [1,2] vs [2,1] → 2 changes if order matters, none if it does not
  • 18 vs "18" → ~ changed, type: number → string

Which setting to use when

If the order of a list in an API response carries meaning (ranked search results, steps, pages), leave "Matters"; items are compared position by position. If the list works like a set (tags, permissions, a mailing list), choose "Does not matter"; an item matches wherever it is, and only items that were really added or removed are reported.

For a change report, "Differences only" is enough. To review two configuration files end to end, choose "All fields"; unchanged values are listed too, indented with spaces. Very large integers (above 2^53, such as 19-digit IDs) can be rounded by JavaScript, so the tool warns in the result line when it meets one.

Frequently asked questions

How do I compare two JSON files?

Paste the first JSON into the left pane and the second into the right pane. The tool compares both as trees and prints each difference with its path: "~ $.price: 24.99 → 21.99" means the price changed, "- $.seller.state" means the field was removed.

Does a different key order count as a difference?

No. Key order has no meaning in a JSON object; {"a":1,"b":2} and {"b":2,"a":1} hold the same data and the tool reports no differences. Indentation, spaces and line breaks are ignored as well.

Can I ignore the order of items in arrays?

Yes. Set "Order inside arrays" to "Does not matter". Then ["a","b"] and ["b","a"] count as equal, and only items present in one list but not the other are shown with + or -.

Is the JSON I paste sent anywhere?

No. The comparison runs entirely in your browser; even a JSON holding API keys or customer data never reaches a server.