Developer Tools

JSON Compare

This tool compares two JSON documents by structure rather than by text. That distinction is the whole point: key order and indentation carry no meaning in JSON, so a text diff of two equivalent payloads can light up every line while a structural comparison correctly reports that nothing changed.

Runs entirely in your browser — nothing you paste is uploaded.

How to

How to use the JSON Compare

  1. 1

    Paste both documents

    Put the original on the left and the new version on the right. Each is validated separately, so an error in one is reported against that side.

  2. 2

    Read the summary

    Counts of added, removed and changed values tell you the scale of the difference before you read any of it.

  3. 3

    Work through the paths

    Each difference is listed with a path such as $.items[2].price, so you can find it in the original document immediately.

  4. 4

    Confirm a match

    When the documents are equivalent the tool says so plainly, regardless of how differently the two were formatted.

Examples

JSON Compare examples

Reordered keys

Input
{"a":1,"b":2} vs {"b":2,"a":1}
Output
Identical

A text diff reports both lines as changed. Key order has no meaning in JSON, so a structural comparison correctly finds nothing.

A changed nested value

Input
{"user":{"age":30}} vs {"user":{"age":31}}
Output
$.user.age changed: 30 → 31

The path points straight at the value that moved, which is what you need in a document with several hundred keys.

An added array element

Input
[1] vs [1,2]
Output
$[1] added: 2

Arrays are compared by position, since order is meaningful in a JSON array in a way it is not for object keys.

Why use it

What the JSON Compare gives you

No false differences

Reformatting, reindenting and reordering keys are all invisible, so the differences reported are differences that matter.

Paths you can use

Every entry is addressed with a path expression, which can be pasted into a query or used to navigate the original document.

Handles deep nesting

Objects within arrays within objects are walked recursively, so a difference buried six levels down is found and named.

Runs in your browser

Comparing two API responses often means comparing two sets of real customer records. Neither is uploaded.

Good to know

JSON Compare limitations

  • Arrays are compared by position, so a reordered list reports every element as changed even when the same values are present.
  • Very large documents produce a long list of differences, which is accurate but hard to read.
  • Numbers are compared after parsing, so two values that differ only beyond JavaScript's precision appear equal.
  • The comparison shows what differs, not why — it has no knowledge of your schema or which fields are expected to change.

Summary

JSON Compare in short

  • Key order and formatting are ignored, so only real differences appear.
  • Arrays are compared by position, because order is meaningful in an array.
  • Every difference is reported with a path expression.
  • Two documents that differ only in layout are correctly reported as identical.
  • Everything runs in your browser.

FAQ

JSON Compare questions

How is this different from a normal text diff?

A text diff compares characters, so reindenting a file or reordering its keys shows as changes on every affected line. This compares the parsed structures, where key order does not exist as a concept, and reports only genuine differences in value.

Does key order ever matter in JSON?

Not to the specification — an object is an unordered set of pairs. Some systems preserve insertion order in practice, but relying on it is a bug waiting to happen, which is why it is treated as insignificant here.

Why are arrays compared by position?

Because order is meaningful in a JSON array. Treating arrays as unordered would report a reversed list as identical, which is usually wrong. The trade-off is that inserting one element at the start shows every later element as changed.

What do the paths mean?

They follow the usual JSONPath convention: $ is the root, a dot introduces an object key, and square brackets index into an array. So $.items[0].name is the name field of the first element of the items array.

How is a type change reported?

As a changed value, showing both sides. A field that was the number 1 and is now the string "1" is a difference that frequently breaks clients, so it is never treated as equal.

Is a null value the same as a missing key?

No, and the distinction is deliberate. A key present with a null value is reported as changed, while a key that has gone entirely is reported as removed — a difference that matters to most APIs.

What if there are hundreds of differences?

They are all listed, ordered by path. If the list is overwhelming it usually means the two documents are not really versions of each other, or an array has shifted by one position near the start.

Are very large numbers compared reliably?

Only within JavaScript's exact integer range. Two ids differing beyond 2^53 both round to the same value on parsing and will be reported as equal — the JSON viewer will warn you when a document contains such numbers.

Are the documents I compare uploaded?

No. Both are parsed and compared in this page. Comparing a production response against a staging one usually means handling real customer data, and none of it is transmitted.

Discover

Related developer tools