99tools

JSON Diff

runs in your browser

Compare two JSON documents and see exactly what changed. Key order and whitespace are ignored, and you can copy the result as a JSON patch.

Panes

Key order and whitespace are ignored. Arrays are compared by position.

Original

Changed

Differences

Paste valid JSON into both panes to see the differences.

about this tool

Comparing structure, not text

Paste two JSON documents and you get a list of what actually changed: which paths were added, which were removed, and which hold a different value. That is a different job from a text diff, which would report a reformatted or reordered document as changed from top to bottom even though the data is identical.

Object key order is ignored, because in JSON it carries no meaning. Array order is respected, because there it does.

For prose or code, where line order is the point, use the text diff instead. And if two documents differ only in key order, the JSON formatter's sort-keys option makes them identical before you compare.

Reading a path

Every change is reported at a path such as user.address.city or items[2].price, so you can find the value in your own code without counting braces. Paths are also available as JSON Pointer — /user/address/city, the RFC 6901 form — which is what you need if you are feeding the result to a library.

Getting a JSON Patch

The differences can be emitted as a JSON Patch (RFC 6902): an array of add, remove and replace operations that transforms the left document into the right one. That is directly useful when you want to send only what changed to an API that accepts patches, or to record a migration between two fixture files.

What the summary tells you

The counts of added, removed and changed paths are usually the answer people came for: whether a deployment altered a config in more places than expected, or whether two API responses that look different actually differ in one field. A diff of two hundred lines that reduces to one changed value is a much easier conversation than the raw text.

Colour is never the only cue

Added and removed entries carry a symbol and a position as well as a colour, so the output remains readable if you are colour-blind or working in greyscale.

Why this stays local

Both documents are parsed and compared in the page. That is what makes it usable for the comparisons that matter most — a staging response against production, or a customer record before and after a support edit — where uploading either side to a web service would not be acceptable.

questions

How is this different from a text diff of two JSON files?
A text diff reports a reformatted or reordered document as changed from top to bottom. This compares the parsed data, so object key order is ignored and you get a list of the paths that actually differ.
Does it treat reordered arrays as changed?
Yes, because order is meaningful in a JSON array. Object key order is ignored, because there it carries no meaning. That distinction matches how JSON itself is defined.
Can I get the differences as a JSON Patch?
Yes. The changes can be emitted as an RFC 6902 patch of add, remove and replace operations that transforms the left document into the right one, which is what you need to send only the delta to an API.
What notation are the paths in?
Both a readable dotted form such as items[2].price and RFC 6901 JSON Pointer such as /items/2/price. Use the first to find the value by eye and the second to feed a library.
Are the documents uploaded to compare them?
No. Both are parsed and compared in your browser, which is what makes it usable for comparing a staging response against production, or a record before and after an edit.