JSON diff that ignores key order
Compare two JSON documents and see only what really changed: key order and spacing are ignored, list items can be matched by id, and every difference has its path.
Paste JSON
Tree
The tree of your JSON appears here.
Paste JSON in first; its readable text, tables and types appear here.
Before
After
Differences
Paste valid JSON on both sides to compare them. Key order and spacing are ignored.
How to compare JSON
- Paste the old version in Before and the new one in After, or try the example.
- pastejson suggests a key such as
idwhen your lists have one; turn it off to compare by position. - Read the summary and the table of changes, or switch to the list view.
- Click a path to copy it, or copy every difference as text.
Why a text diff is not enough
Two API responses can contain exactly the same data and still look completely different to a line-by-line diff: the keys come in another order, one is pretty-printed and the other is not, or the items of a list were returned in a different order. pastejson compares meaning, not text. Objects are compared key by key, numbers by value (so 1 and 1.0 are equal), and whitespace never counts.
Matching list items by id
When a list holds records with an identifier, comparing by position reports nearly everything as changed as soon as one record is inserted or the order changes. With matching by key, each record in After is paired with the record in Before that has the same id (or sku, uuid and similar), so a reordered list shows no changes and an inserted record shows as one addition. If some records lack the key, that list is compared by position and the page tells you so.
Reading the result
Each change is marked as changed, added or removed, with its path and the values before and after. Paths of added and changed values point into After; paths of removed values point into Before. Copy as text writes one line per change, ready for a ticket or a code review.
Questions
Does the order of keys matter?
No. Objects are compared by key, so the same keys in a different order are equal.
Can I compare large files?
Yes. Two documents of about 6 MB with 14,000 reordered records are compared in well under a second.
What does matching by key do?
It pairs list items by an identifying field such as id, so reordering is not reported as a change.
Is my data sent anywhere?
No. Both documents are compared in your browser and never uploaded.
Can I share the differences?
Copy as text gives one line per change with its path and values, which you can paste anywhere.