>Fafa Dev Tools

JSON Diff

Compare two JSON strings and highlight differences line by line. Free online JSON diff tool with added, removed, and changed line detection.

What is JSON Diff?

JSON Diff compares two JSON inputs and highlights the differences between them. Both JSON strings are normalized (pretty-printed with consistent indentation) before comparison, so formatting differences are ignored. The tool shows added lines (green), removed lines (red), and changed lines (amber) in a side-by-side view.

How to Use

  1. Paste the original JSON in the left panel
  2. Paste the modified JSON in the right panel
  3. Click Compare to see the differences
  4. Green lines are new, red lines are removed, amber lines are changed

Examples

Detect changed value

InputLeft: {"name":"John","age":30}
OutputRight: {"name":"Jane","age":30,"email":"jane@example.com"} — name changed, email added

Find added fields

InputLeft: {"a":1,"b":2}
OutputRight: {"a":1,"b":2,"c":3} — field "c" added

Frequently Asked Questions

Does formatting affect the comparison?

No. Both JSON inputs are normalized (parsed and re-formatted) before comparison. Whitespace, key order, and indentation differences are ignored — only actual data differences are shown.

How does the diff algorithm work?

The tool uses a Longest Common Subsequence (LCS) algorithm to find the optimal alignment between the two formatted JSON strings. This produces an accurate diff that correctly identifies added, removed, and changed lines.

Can I compare JSON arrays?

Yes. Both JSON objects and JSON arrays are supported. The tool compares the formatted output line by line, so it works with any valid JSON regardless of the top-level type.