What gets compared
Both inputs are parsed, re-formatted with two-space indentation and, with Ignore key order on,
have their object keys sorted alphabetically. The formatted versions are then compared line by line. This means
minified versus pretty-printed JSON, different indentation, and {"a":1,"b":2} versus
{"b":2,"a":1} all compare as equal.
Above the line view you get a list of every difference by path, such as
$.order.items[2].price, with the old and new value — handy for API responses where the interesting
change is buried deep in the structure.
Things to know
- Arrays are compared by position. Inserting an element at the start of an array shifts every later index, so the path list will report each of them. The line view below still aligns the moved block sensibly.
- Numbers are compared as values:
1.0and1are equal. Integers larger than 253 (about 9 quadrillion) lose precision in JavaScript, so very long numeric IDs may compare as equal when they differ only in the last digits. Store such IDs as strings. - Comments and trailing commas (as in
tsconfig.jsonor VS Code settings) are accepted when Allow comments & trailing commas is on. Turn it off to validate strict JSON. - If either side is not valid JSON, the exact line and column of the problem are shown under that box. Click it to jump there.
Just need to format or validate one document?
Use the JSON formatter. To compare configuration written in YAML, use the YAML diff.
Is my data uploaded?
No. The comparison runs in your browser, so nothing you add is sent to gratistools.be. It only leaves your device if you sign in and press Save, which stores that one comparison in your account until you delete it. See the privacy page for details.