Back to Home
Published: June 2026By Web Util Slyce Team6 min read

JSON Diff — How to Compare JSON Objects

Learn how to compare JSON objects and find differences. Use our JSON Compare tool to diff JSON side by side, or format JSON first with the JSON Formatter.

Simple Value Changes

The most common diff — a field value is modified between two JSON objects.

Before
{
  "name": "John Doe",
  "email": "john@old.com",
  "age": 30
}
After
{
  "name": "John Smith",
  "email": "john@new.com",
  "age": 30
}

Added & Removed Fields

API responses often gain or lose fields between versions.

Before
{
  "id": 1,
  "title": "Post Title",
  "content": "Lorem ipsum..."
}
After
{
  "id": 1,
  "title": "Post Title",
  "content": "Lorem ipsum...",
  "published": true,
  "tags": ["json", "diff"]
}

Nested Object Changes

JSON diffing handles deep comparison of nested structures.

Before
{
  "user": {
    "name": "Jane",
    "address": {
      "zip": "94105",
      "city": "SF"
    }
  }
}
After
{
  "user": {
    "name": "Jane",
    "address": {
      "zip": "94110",
      "city": "San Francisco",
      "state": "CA"
    }
  }
}

Array Differences

Arrays can be compared by index, content, or key (when items have IDs).

Before
{
  "items": [1, 2, 3, 4]
}
After
{
  "items": [1, 2, 5, 4, 6]
}

Common JSON Diff Use Cases

API response changes

Compare API responses between versions to verify backward compatibility or find breaking changes.

Configuration file drift

Track how config files differ across environments (dev, staging, production).

Database record comparison

Compare serialized JSON data to audit field-level changes over time.

Code review

Review JSON data structure changes in pull requests, especially for schema files.

Data migration validation

Verify that migrated data matches the source by diffing JSON exports.

Frequently Asked Questions

How does JSON diff handle key order?

JSON objects are unordered by specification. Good diff tools sort keys before comparing or show differences regardless of key order.

Can I compare JSON files with different structures?

Yes. JSON diff works on any two JSON values — objects, arrays, strings, numbers. Fields present in only one file are shown as additions or deletions.

What's the difference between JSON diff and JSON compare?

These terms are used interchangeably. Both refer to finding differences between two JSON inputs, typically displayed side by side.