JSONBeautify JSON Linter

JSON Diff: Compare Two JSON Documents

Paste two JSON documents to see every value that was added, removed or changed, each listed by its JSON Pointer path. The comparison runs in your browser, and the report can be copied.

JSON Diff DEPTH CAP 64

Paste two JSON documents and get a path-level diff with JSON Pointer locations. Recursive, order-sensitive for arrays, 100% in your browser.

Document A
Document B
Diff Report

How the diff decides what changed

Every report below came from this page's diff when the site was built, so you can paste both documents above and get the same lines. These are the cases where JSON diffs most often surprise people: ordering, types, null, numbers and escapes.

Key order

Objects are compared by their members, so the same keys in a different order are equal.

Document A

{"a":1,"b":2}

Document B

{"b":2,"a":1}

Diff report

No differences.

Array order

Arrays are compared by position. Reversing three items changes two indexes; the middle one stays put.

Document A

[1,2,3]

Document B

[3,2,1]

Diff report

changed  /0  1 -> 3
changed  /2  3 -> 1

Number formatting

Numbers are compared as values after parsing, so 1 and 1.0 are equal.

Document A

{"n":1}

Document B

{"n":1.0}

Diff report

No differences.

A number against a string

Same digits, different types: this is a real difference to whatever reads the document.

Document A

{"n":1}

Document B

{"n":"1"}

Diff report

changed  /n  1 -> "1"

null against a missing key

A key set to null and a key that is absent are different, and many APIs treat them differently.

Document A

{"a":null}

Document B

{}

Diff report

removed  /a  null

A key containing a slash

Paths are JSON Pointers (RFC 6901), so a / inside a key is written ~1, and a ~ is written ~0.

Document A

{"a/b":1}

Document B

{"a/b":3}

Diff report

changed  /a~1b  1 -> 3

Integers beyond 2^53

These two integers differ, but both parse to the same JavaScript number, so the diff reports them equal. The JSON validator on this site flags numbers that lose precision when parsed.

Document A

{"big":9007199254740993}

Document B

{"big":9007199254740992}

Diff report

No differences.

An object appended to an array

Changes are listed per leaf value, so the new object appears as its id field.

Document A

{"x":[{"id":1}]}

Document B

{"x":[{"id":1},{"id":2}]}

Diff report

added    /x/1/id  2

Escaped against literal characters

Escapes are decoded before comparing, so \u00e9 and é are equal.

Document A

{"s":"é"}

Document B

{"s":"\u00e9"}

Diff report

No differences.

More from JSONBeautify

Guides

All tools →All 13 guides →

Developer Sponsor / Partner
Copied to clipboard!