JSON Pretty Diff
Paste two JSON values to see a line-by-line diff of their normalized (pretty-printed) forms. Optionally sort object keys before diffing to ignore insertion-order differences. Added lines are highlighted green, removed lines red. Runs in your browser.
Compare two JSON documents after parsing and pretty-printing them, with optional recursive key sorting. The result is shown as a line-by-line diff with added, removed, and unchanged lines.
How to compare two JSON documents
- Paste the first JSON document on the left.
- Paste the second JSON document on the right.
- Leave Sort keys enabled if property order should be normalized before comparison.
- Run the comparison and review added and removed lines.
- Correct invalid JSON if either side reports a parse error.
How normalization and diffing work
Each non-empty side is parsed with JSON.parse and serialized with two-space indentation. When Sort keys is enabled, object keys are sorted recursively while array order is preserved.
For normal inputs, the tool uses an LCS-based line diff. If the product of the two line counts exceeds 200,000, it skips the expensive LCS table and falls back to showing every left line as removed followed by every right line as added.
Privacy and limitations
Comparison runs locally in the browser and the JSON is not intentionally uploaded. This is a structural normalization followed by a line diff, not a semantic JSON Patch generator. Large documents may use the simpler fallback, and array element order always remains significant.
Frequently asked questions
Does property order matter?
With Sort keys enabled, object keys are recursively sorted before comparison, so property order alone does not create a difference.
Are arrays sorted too?
No. Array order is preserved because reordering array elements can change meaning.
What happens with invalid JSON?
The tool reports which side is invalid and does not produce a normalized comparison for that side.
Why can a very large comparison look coarse?
When line-count multiplication exceeds 200,000, the tool uses a simpler all-removed/all-added fallback instead of the LCS diff.
Does it generate JSON Patch operations?
No. It displays a readable normalized line diff only.