All Tools

JSON Compare: Find Differences Between Two JSON Files

Compare two JSON documents by structure in your browser. See every added, removed, changed and type-changed value with its path, ignore key or array order, and get a summary count. Nothing is uploaded.

Treats arrays as unordered collections of items.

Skips comments and trailing commas before comparing.

Paste a JSON document on each side to compare them.


About the JSON Compare tool

The JSON Compare tool finds the differences between two JSON documents by structure, not by text. Paste the original on the left and the changed version on the right, and the tool lists every member that was added, removed or changed, and every value whose type changed, each with the path where it happened. A summary line counts each kind, and when the two documents mean the same thing it simply says Identical.

Your JSON never leaves your device. Both documents are parsed and compared by JavaScript on this page, so nothing is uploaded, logged or stored. That makes the tool suitable for API responses, feature flags and configuration files that contain private data.

How to use it

Steps

  1. Paste the original document into Left JSON.
  2. Paste the changed document into Right JSON. The comparison updates as you type.
  3. Turn on Ignore array order if the order of items in your lists carries no meaning.
  4. Turn on Repair if either side contains comments or trailing commas.
  5. Press Swap to see the comparison the other way round: additions become removals.

Why a structural diff

A line-by-line Text Diff treats {"a":1,"b":2} and a pretty-printed copy with the keys in another order as completely different. JSON Compare parses both documents first, so whitespace, indentation and key order never count. Objects are matched member by member, arrays item by item, and only real differences in data are reported. If you want to read either document comfortably first, the JSON Formatter indents it and the JSON Viewer shows it as a tree.

Reading the paths

Each difference names the place where it happened. $ is the whole document, .name steps into an object member and [2] steps into the third item of an array, since indexes start at zero. A key that is not a plain identifier is written in brackets and quotes, such as $["first name"]. For example, comparing {"a":{"b":[1,2,3]}} with {"a":{"b":[1,2,4]}} gives exactly one row: Changed at $.a.b[2], 3 → 4.

Numbers are compared by value

1 and 1.0 are the same number, so they are not reported as a change. Integers are compared exactly, digit for digit, so two 20-digit IDs that differ only in the last digit are still caught, even though ordinary JavaScript would round both to the same value.

Ignore array order

By default arrays are ordered, as the JSON standard defines them: item 0 is compared with item 0. With Ignore array order on, each item on the right cancels one equal item on the left, wherever it is, and repeats are counted. [1,1,2] against [1,2,2] therefore reports one 1 removed and one 2 added. Objects inside the arrays are still compared regardless of their key order.

Limits

When an object contains the same key twice, the last value is used, as in most JSON parsers. The table shows the first 500 differences so the page stays responsive, while the summary counts all of them. A parse error stops the comparison and names the side, the line and the column, with the offending line shown under a caret.

Open-source credits

  • The comparison is written for this site. Documents are parsed according to RFC 8259 (The JavaScript Object Notation Data Interchange Format) by the same in-house parser as the JSON Formatter.
  • Paths use the $ root and bracket notation of JSONPath, RFC 9535. To address the same place with a JSON Pointer, RFC 6901, write each step after a slash: $.a.b[2] becomes /a/b/2.
  • The tool uses no third-party library.

Frequently asked questions

Does the order of keys matter when comparing JSON?

No. JSON objects are unordered collections of names and values, so two objects with the same members in a different order are reported as identical. Only the members and their values are compared, never the position of a key or the whitespace around it.

What does Ignore array order do?

Arrays are ordered in JSON, so by default item 0 is compared with item 0, item 1 with item 1 and so on. With Ignore array order on, each array is treated as a collection where an item matches any equal item on the other side, and repeats are counted. Use it for lists such as tags or IDs whose order carries no meaning.

Why are 1 and 1.0 reported as the same value?

They are the same number written two ways. The tool compares numbers by value, so 1, 1.0 and 1e0 are equal. Integers are compared exactly with arbitrary precision, so two large IDs that differ only in the last digit are still reported as different.

How do I read a path such as $.items[2].name?

The dollar sign is the whole document. A dot followed by a name steps into an object member, and a number in square brackets steps into an array item, counting from zero. Names with spaces or symbols are written in brackets and quotes, for example $["first name"].

Is my JSON sent anywhere?

No. Both documents are parsed and compared by JavaScript in your browser. Nothing is uploaded or stored, so it is safe to compare API responses or configuration that contains private data.

Other related tools