Skip to main content
PocketToolz

JSON Diff

Compare two JSON documents structurally, so key order and formatting do not matter.

DeveloperRuns in your browserFree, no signup

About the JSON Diff

A line-based diff on JSON is close to useless, and it is what most people reach for. Reorder the keys and every line shows as changed while nothing changed at all. Reformat the file and the whole document is different. Change one value six levels down and you are told a line differs rather than which path to look at.

This compares the parsed values instead. Whitespace and key order are irrelevant by construction, and every difference is reported as the path where it lives — `config.retries`, `users[2].email` — which is something you can act on directly.

Type changes are separated from value changes, because they usually mean something different. A number becoming the string "3" is almost always a serialisation bug rather than an intentional edit, and burying it among ordinary value changes is how it gets missed.

One honest limitation: arrays are compared by position. Insert an item at the front and every later index reports as changed, because working out that it was an insertion rather than a wholesale rewrite is a substantially harder problem and any attempt at it guesses at intent. Comparing by index and saying so is more useful than a clever answer that is sometimes wrong.

Both documents are parsed and compared in your browser. API responses are exactly the sort of thing that carries real customer data, and none of it goes anywhere.

How it works

  1. Paste the two documents — an API response before and after, two config files.

  2. Differences are reported as paths rather than line numbers.

  3. Key order and formatting are ignored, because they are not differences.

Frequently asked questions

Why not just use a text diff on JSON?
Because key order and formatting are not differences, and a text diff cannot tell. Reordering keys shows every line as changed; reformatting shows the entire file as different. Comparing the parsed values sidesteps both.
Does key order matter?
No. Two documents with the same data in different key order are reported as identical, which is correct — JSON objects are unordered by definition.
How are arrays compared?
By position. That means inserting an item at the front shows every later index as changed. Detecting the insertion instead is a much harder problem and any solution guesses at intent, so this compares by index and tells you it does.
What is a type change?
The value at a path changed kind rather than content — a number became a string, or an object became null. It is called out separately because it is usually a serialisation bug rather than a deliberate edit, and it is easy to miss among ordinary changes.
Are my documents uploaded?
No. Both are parsed and compared in your browser, which matters because API responses routinely contain real customer data.

Privacy

Everything happens locally. Your files are read by your own browser, processed on your device, and never uploaded — closing the tab is all it takes to erase them.

Related tools