Help
  • Preserves high-precision numbers
  • Click "Sample" to view an example
  • Click the Settings button for advanced options

JSON Diff

This free online JSON diff tool compares two JSON documents and highlights the differences.

All tools on this site run entirely in your browser locally. No data is uploaded to any server.

Features:

  • JSON Format: Auto-formats as you type
  • DICT to JSON: Auto-converts Python dict to JSON when formatting
  • Unescape: Auto-unescapes characters when inputting escaped JSON
  • Repair JSON: Auto-repairs invalid JSON

Diff Mark:

  • Red Mark: Content that appears only on the left compared to the right
  • Green Mark: Content that appears only on the right compared to the left
  • Line number redirect: Click a diff line to jump to it

FAQ:

  • Q: Do I need to click a Compare button, and what do the red and green underlines mean?
    A: There's no Compare button: the diff refreshes automatically whenever you edit either side. Red underlines mark text that appears only on the left, green underlines text that appears only on the right. Identical lines stay visible instead of being folded away. Differences are cleaned up semantically, so neighbouring edits are grouped into readable blocks rather than flagged character by character. When the two sides match, the result reads "Both sides identical"; if either side is empty, the result area stays blank.
  • Q: Is JSON formatted automatically, and why doesn't it reformat as I keep typing?
    A: Each pane is formatted once, on the first text you type or when you load a local file, using five-space indentation. Further typing won't reformat it; use the Format button for that pane, or clear it and start again to trigger auto-formatting once more. The Format button only tidies the layout — unlike auto-formatting, it won't try to repair malformed JSON, strip escapes or sort keys.
  • Q: What happens to malformed JSON, Python-style literals and escaped strings?
    A: Auto-formatting works through a sequence: Python's True, False and None become JSON literals, then it tries a direct parse, trims to the outermost braces or brackets, strips escapes and retries, and finally hands the text to JSON Repair. If none of these work, it only indents the text and warns you to check the highlighted marks.
  • Q: What does auto sort do, and are numbers normalised?
    A: With auto sort on, each formatting pass reorders object keys recursively in standard string order — case-sensitive, so uppercase keys come before lowercase ones. Only the key order changes; values are untouched, which helps when two JSON documents differ only in key order. Numbers are written back exactly as entered: large integers keep their precision, and 1.0 vs 1.0000 still counts as a difference.
  • Q: How are the "Diff lines" numbers chosen, and what happens when I click one?
    A: Each number is the first line of a diff block in the left editor, and every block gets its own clickable number. Hover over the result to see the full list. Clicking one scrolls both editors to that spot, moves the left cursor to the start of the line and thickens it for five seconds, with a "Jumped to line N" confirmation.
  • Q: Why is the Restore button sometimes greyed out, and are settings remembered?
    A: Each side keeps its own copy of the last text you entered, saved locally in the browser whenever that side has content. The button is available only when you've just opened the page, a saved copy exists and you haven't started typing yet; once you edit, it's disabled so a stray click can't overwrite what you're working on. "Wrap long lines", auto sort and "Editor save format" (JSON or TXT) are remembered too and restored on your next visit. "Wrap long lines" only changes how long lines are displayed, not the text or the diff.