Skip to content
browserutils
How-to

How to Compare JSON and Find Differences

Diff two JSON documents side by side to find added, removed, and changed values, using structural comparison that ignores key order and formatting.

4 steps
  1. 1

    Paste the first JSON

    Copy your baseline or original JSON document and paste it into the left input panel.

  2. 2

    Paste the second JSON

    Copy the modified or comparison JSON document and paste it into the right input panel.

  3. 3

    Review the differences

    The tool highlights added, removed, and changed values with color coding. Navigate through differences to understand exactly what changed.

  4. 4

    Export the diff

    Copy the diff output or use it as a reference to reconcile changes between the two documents.

Comparing two JSON documents by eye is nearly impossible once they exceed a few dozen lines. Whether you are debugging why an API response changed, reviewing configuration updates, or verifying a data migration, the JSON Diff Tool highlights exactly what is different between two JSON structures so you do not miss anything.

Understanding JSON diffing

A JSON diff compares two documents structurally rather than textually. Unlike a plain text diff that compares line by line, a JSON diff understands that {"a":1,"b":2} and {"b":2,"a":1} are semantically identical even though the text is different. This structural awareness means the diff only reports meaningful changes — added keys, removed keys, and changed values — without false positives from formatting or key ordering differences.

The diff operates recursively through nested objects and arrays. For objects, it matches keys between the two documents and reports any mismatches. For arrays, the comparison is position-based by default: it compares element 0 with element 0, element 1 with element 1, and so on. This means inserting an element at the beginning of an array will show every subsequent element as changed.

Diff output typically categorizes changes into three types: additions (present in the second document but not the first), deletions (present in the first but not the second), and modifications (present in both but with different values).

Tips and best practices

  • Format both documents first. Consistent formatting makes the diff output easier to read. Use the JSON Formatter on both inputs before comparing.
  • Sort keys before diffing. If key order varies between your documents, sort keys alphabetically to eliminate false positives and focus on actual value changes.
  • Compare normalized data. If your JSON contains timestamps, IDs, or other values that change every time, consider removing them before diffing to focus on structural and data changes.
  • Use the diff for regression testing. Save expected API responses as JSON fixtures and diff them against actual responses to catch unexpected changes.

Common issues

  • Array diffs show too many changes. Because arrays are compared by position, inserting or removing a single element can make every subsequent element appear changed. If your arrays are unordered sets, consider sorting them by a key before comparing.
  • Floating point differences. Values like 1.0 and 1 may or may not be considered different depending on the diff tool. JSON does not distinguish between integer and float representations, but some diff implementations do.
  • Large documents are slow to compare. Deeply nested JSON with thousands of keys can take time to diff. If performance is an issue, extract and compare specific sections rather than diffing the entire document.
Try it now

Open JSON Diff

Use the JSON Diff tool directly — no sign-up needed. Runs entirely in your browser.

Open JSON Diff