Compare Two JSON Files Online

Paste two JSON documents and get a list of what differs: which keys were added, which were removed, and which changed value. Key order and whitespace are ignored, because neither changes what the document means.

Original
Changed
Differences

Paste a document into each box. The comparison runs as you type and nothing is uploaded.

What this compares

The comparison is structural rather than textual. Two documents with the same keys in a different order are equal, and so are two documents formatted differently. A text diff would report both as changed, which is noise when what you want to know is whether the data is the same.

Every difference is reported with its full path, so a change buried four levels down reads as items[2].price rather than as a line number you then have to go and find.

Arrays are compared by position. An element inserted at the front therefore reports every later element as changed, which is correct: at index 3 the value really is different. If your arrays are unordered sets, sort them before comparing.

What counts as a change

A value is changed when the type differs, or when the value differs. The string "5" and the number 5 are a change, because a consumer of the document will treat them differently.

null and a missing key are not the same thing. A key present with a null value reports as changed against a document where the key is absent, because that distinction matters to almost every JSON consumer.

Questions

Does key order matter?

No. JSON objects are unordered by definition, so two documents with the same keys in a different sequence compare as identical. Arrays are ordered and are compared by position.

Can I compare two large files?

Yes. The comparison runs in your browser with no upload, so the limit is your machine's memory. Documents of a few megabytes compare in well under a second.

Are my files sent anywhere?

No. Both documents are parsed and compared by JavaScript on this page. Nothing is transmitted, which you can confirm in your browser's network tab.

Other tools