JSON diff

← All tools

Paste two JSON values and read every added, removed, changed, or moved field. Objects are compared by key, so key order does not count.

Both sides stay in the browser. Nothing is uploaded, and nothing is put in the URL.

~~~
Open file…
Open file…

Not compared

No differences. Key order is ignored.

~~~

About this tool

A line diff treats a reordered key, or a change in indentation, as a change. This page parses both sides first. Two objects with the same keys and values compare equal even when the keys are written in a different order.

Each difference is one line. A changed field shows the path, the left value, and the right value. An added field exists only on the right. A removed field exists only on the left. A missing key is not the same as a key whose value is null. The number 1 and the string "1" are a change.

Arrays of objects are matched by id, _id,key, slug, or name, in that order, when every item on a non-empty side is an object with that field and the values are unique. A reorder is then reported as a move, and a field change is reported on that same item. Every other array, including one with duplicate ids, is compared by index, so a reorder looks like paired changes. The page lists the first 400 lines. Each side accepts a file up to 2 MB.

Both sides must be JSON that JSON.parse accepts. A broken side is named in the error. Integers above 9007199254740991 are rounded by JavaScript before the comparison, and the page says so. A long value in a line is cut at 160 characters.

~~~

Read more

~~~

Free books, courses, and software

Get my programming books, course editions, and complete software.

Get the download library →