Format and indent JSON, with optional alphabetical key sorting and a precise syntax error when it will not parse.
JSON Diff
Compare two JSON documents structurally, by path, distinguishing a type change from a value change.
- Free
- No sign-up
- Runs in your browser
Input
0 characters
Processed entirely in your browser. Nothing is uploaded.
0 characters
Try an example
Fill in First document and Second document to continue.
Enter your input to see the result
Everything happens on this device. No upload, no account, no network request.
How to use this tool
- 1
Paste your JSON into the box.
- 2
A syntax error is reported with its line and column, an excerpt with a caret, and the likely cause - a trailing comma, single quotes, an unquoted key or a comment.
- 3
Copy or download the result.
Questions about JSON Diff
Why is a type change reported separately?
Because `"5"` becoming `5` is a different kind of problem from `5` becoming `6`. The first is almost always a serialisation bug - a number that went through a string somewhere - while the second is a data change. Lumping them together hides the more interesting one.
Why does inserting one array element show everything as changed?
Arrays are compared by index, so inserting at the front shifts every later element. That is the honest result of an index comparison; a tool that guessed at element identity would be confidently wrong on data where order matters.
Why does it report duplicate keys?
Because nothing else does. `JSON.parse({"a":1,"a":2})` silently gives `{a: 2}` - the first value vanishes with no error. In a configuration file that is a genuinely hard bug to find, so the duplicate is detected in the source text and reported.
Is my data sent anywhere?
No. This tool runs as JavaScript inside your browser tab. There is no network request carrying your input, nothing is written to a server log, and it keeps working with your connection switched off. You can confirm it in the browser’s network panel. That matters more here than elsewhere on the site: developer tools handle tokens, keys and production data.
Does the JSON Diff work offline?
Yes. Once the page has loaded it runs entirely as JavaScript on your own device, so the JSON Diff keeps working with the network switched off and nothing is ever sent to a server.
Related tools
Other tools you might reach for next.
Strip every byte of insignificant whitespace from JSON and report the saving.
Check that JSON is syntactically valid, report its structure, and flag duplicate keys that JSON.parse accepts silently.
Evaluate a JSONPath expression against a document and see every match with the path that produced it.
Escape text so it can be embedded as a JSON string value, handling control characters and astral code points.
Decode an escaped JSON string back to its raw text, with or without the wrapping quotes.
Resolve an RFC 6901 JSON Pointer, with the ~0 and ~1 escapes decoded in the correct order.
Generate TypeScript interfaces from a JSON sample, marking inferred optionals and unions honestly.