Skip to main content

JSON Compare

Diff two JSON documents. Formatting and key order do not count as changes

This tool helps you compare two texts and highlight the differences between them. You can upload files, use example templates, or paste your own text. Switch between edit mode and diff view to see the changes.

Compare as:
Comparing JSON elements, not raw text — formatting, whitespace, and key order are ignored.

How the comparison works

Both sides are parsed as JSON, their object keys are sorted recursively, and each is written back out with the same indentation. The two normalised documents are then compared line by line and word by word. Two files that hold the same data therefore compare as identical, however they were formatted or ordered.

Arrays keep their order, because the order of items in an array is part of the data: [1, 2] and [2, 1] are reported as different. Both sides must be valid JSON. If one is not, the page says which side failed to parse.

When to use it

Typical cases are comparing two API responses (before and after a deploy), checking whether a config file differs between environments, reviewing a change to a fixture or snapshot file, and confirming that a re-serialised export still holds the same data.

In the diff view you can switch between split (two columns) and inline (one column), and show only the changed lines. To compare YAML or XML the same way, use Diff Checker and pick the YAML or XML mode.

A normal text diff flags every reordered key and re-indented line, which buries the changes you care about. This tool parses both documents first, so only differences in the data show up.

Frequently Asked Questions

Does it ignore the order of keys?

Yes. Object keys are sorted before the comparison, so {"a":1,"b":2} and {"b":2,"a":1} are identical. Array items keep their order because it is part of the data.

Why are two arrays with the same items marked as different?

The items are in a different order. JSON arrays are ordered, so a reordered array is a real change. If order does not matter in your data, sort the arrays before comparing.

Is my data uploaded?

No. Parsing and comparison happen in your browser. Neither document is sent to a server.

What if one side is not valid JSON?

The page names the side that failed and shows the parser's message. Use the JSON Validator to find the exact line.

Have suggestions or feedback? We're constantly improving FormatChamp based on your comments.