DiffKit / JSON compare
JSON compare
Paste two JSON documents to validate them, line them up with sorted keys and see every added, removed or changed value by its path. Formatting and key order stop getting in the way.
Text diff vs. JSON diff
A plain text diff compares characters, so reformatting a file with a different indent or a tool that reorders keys makes every line look changed. DiffKit parses both sides first, re-prints them with two-space indentation and, if you want, alphabetical keys. The side-by-side view then shows only the lines whose data really changed, and the list underneath names each change by path, which is easier to paste into a code review or a bug report.
What gets flagged
| Label | Meaning | Example |
|---|---|---|
| Added | The key or array item exists only in the changed document | $.scripts.lint |
| Removed | The key or item exists only in the original | $.private |
| Changed | Same path and type, different value | $.version: "1.4.2" → "1.5.0" |
| Type | The value switched JSON type | $.timeout: 30 → "30" |
Invalid JSON is reported with its line and column, so this page also works as a quick validator. Trailing commas and // comments are not valid JSON, so remove them before comparing. For config files written in YAML, use the YAML compare instead.
Questions people ask
Does key order matter when comparing JSON?
Not in DiffKit by default. The JSON specification (RFC 8259) treats an object as an unordered set of name/value pairs, so {"a":1,"b":2} and {"b":2,"a":1} are the same data. With “Sort keys” on, both sides are normalised before the diff, so only real changes show up. Turn it off to see order changes as well.
Why is "30" reported as a change from 30?
Because a string and a number are different JSON types. Many APIs treat them differently, so a type change is flagged separately from a value change.
What does a path like $.dependencies.vue mean?
It is a JSONPath-style address: $ is the root, dots step into object keys and [n] into array positions. Keys with spaces or symbols are shown in brackets and quotes, for example $["content-type"].
Should arrays be compared by position?
For ordered data like steps or coordinates, yes. For sets such as tags or maintainers, untick “Array order matters” so an item that only moved is not reported as removed and re-added.
Is there a size limit?
Files up to 5 MB load fine. Everything is parsed and compared in your browser, so very large documents depend on your device’s memory.