Skip to content

JSON Comparator — Compare JSON Files Side by Side

Compare two JSON documents online with our free JSON diff tool. Highlight added, removed, and modified fields instantly.

JSON A

JSON B

Differences

0 added 0 removed 0 modified

Click "Compare" to see differences

Detecting Configuration Drift

Your staging config works perfectly, but production is failing. The difference is probably a single changed value buried in a nested object. Manually comparing two JSON files is error-prone when they span hundreds of lines. This tool recursively walks both documents together and compares every value at its path, then reports exactly what was added, removed, or modified.

Unlike a text diff that treats whitespace as changes, this tool parses both documents as JSON and compares their logical structure. A reformatted file with different indentation produces no diff. A single changed value deep inside a nested object gets flagged with its full path.

How It Works

Symbol Meaning Example
+ key Key exists in B but not in A + city: "NYC"
- key Key exists in A but not in B - email: "alice@example.com"
~ key Same key, different value ~ status: "active" → "pending"

Real-World Scenarios

Scenario 1: Staging vs Production config

// Staging (JSON A)
{
  "database": {
    "host": "staging-db.internal",
    "port": 5432,
    "ssl": false
  },
  "debug": true
}

// Production (JSON B)
{
  "database": {
    "host": "prod-db.internal",
    "port": 5432,
    "ssl": true
  },
  "debug": false
}

Diff output:

~ database.host: "staging-db.internal" → "prod-db.internal"
~ database.ssl: false → true
~ debug: true → false

When to Use This Tool

  • Configuration drift when staging and production configs diverge unexpectedly
  • API response changes after an endpoint update to verify expected fields are present
  • Data migration validation to ensure no fields were lost during transformation
  • PR review when a commit modifies JSON fixtures or test data
  • Schema evolution to track how a data format changes across versions

Limitations

  • Array comparison is positional. If you reorder array elements, the tool reports all of them as modified rather than recognizing the reorder.
  • Object key order is ignored. Two objects with the same keys in different orderings are treated as identical.
  • Documents over 5MB may slow the browser. For larger files, consider command-line diff tools.

Frequently Asked Questions

How is this different from a text diff?

A text diff compares raw characters. If one file has extra whitespace or different formatting, a text diff shows many false changes. This tool parses both documents as JSON and compares their logical structure, ignoring formatting differences.

Can I compare JSON with different key orderings?

Yes. Object key order does not affect the comparison. Two objects with identical keys and values but different key orderings are treated as identical.

How are null values handled?

Null is treated as a distinct value. If a key is null in one document and a string in the other, it is reported as modified. If a key is absent in one document, it is reported as added or removed.

What if one input is invalid JSON?

The tool displays a parse error with the line and column number. Both inputs must be valid JSON before comparison. Use the JSON Parser to validate first.

Next Steps