NEW!

JSON Diff

Compare two JSON objects side by side and highlight differences. Detect added, removed, and changed values with export to JSON Patch (RFC 6902).

100% Private & Secure

All processing happens locally in your browser. Your files never leave your device.

Client-Side Processing No Server Uploads No Registration Required
Enter JSON in both panels and click Compare to see differences.
All processing happens locally in your browser. Your data never leaves your device.

Keywords

json diffcompare jsonjson comparejson patch

Need something else?

How to use

1

Paste the original JSON into the left editor panel.

2

Paste the modified JSON into the right editor panel.

3

Click Compare to see all differences highlighted by type — added (green), removed (red), and changed (yellow).

4

Enable Sort Keys to ignore key order differences.

5

Click Export JSON Patch to download an RFC 6902 patch file.

Features

Deep Structural Comparison

Recursively compares nested objects and arrays, showing differences at every depth level with collapsible sections.

Color-Coded Diff Output

Added values in green, removed in red, changed in yellow with old and new values shown side by side.

RFC 6902 JSON Patch Export

Export differences as a standards-compliant JSON Patch document for automated patching workflows.

Sort Keys Option

Normalize key order before comparison to focus on value changes and ignore harmless reordering.

Why Choose This Tool?

Complete Privacy for Sensitive Data

API responses, configuration files, and database exports often contain tokens, credentials, or personal data. Because this diff tool runs entirely in your browser, neither JSON document is ever transmitted to a server. There is zero risk of data interception, logging, or third-party retention. Compare production configs and API secrets with confidence.

Deep Recursive Comparison

Unlike text-based diff tools that compare line by line, this tool understands JSON structure. It recursively walks nested objects and arrays, reporting exactly which keys were added, removed, or changed at every depth level. This structural awareness means reordering keys or reformatting whitespace does not produce false positives.

Standards-Compliant Patch Export

Export differences as an RFC 6902 JSON Patch array — the industry standard for describing JSON mutations. JSON Patch documents can be applied programmatically in any language, making them ideal for CI/CD pipelines, database migrations, and configuration management systems where changes need to be replayed automatically.

No Registration or File Size Limits

Start comparing JSON the moment you open the page. There are no sign-up forms, no usage caps, and no file size restrictions. Whether you are diffing a 10-line config or a 50,000-line API response, the tool processes everything locally in your browser without pagination or truncation.

JSON Comparison: Techniques, Standards, and Best Practices

Comparing JSON documents is a fundamental task in modern software development. Every API change, configuration update, and database migration involves understanding what changed between two versions of a JSON structure. While simple text diffs can show line-level changes, they fail to capture the semantic meaning of modifications in structured data.

Why Text Diff Falls Short for JSON

Traditional line-based diff tools (like Unix diff or Git's built-in diff) treat JSON as plain text. This creates several problems: reordering keys produces massive false-positive diffs, reformatting whitespace shows as changes, and structural modifications (adding a nested object vs. changing a value) are indistinguishable. A dedicated JSON diff tool parses both documents into their object representations and compares them structurally.

Deep Comparison Algorithm

A proper JSON diff recursively walks both structures simultaneously. For objects, it identifies the union of all keys and classifies each as added (exists only in the new document), removed (exists only in the old), changed (exists in both but with different values), or unchanged. For arrays, comparison is performed by index — element 0 is compared to element 0, element 1 to element 1, and so on. Extra elements in either array are flagged as additions or removals.

RFC 6902: JSON Patch

JSON Patch (RFC 6902) is an IETF standard that defines a JSON format for expressing a sequence of operations to apply to a target JSON document. Operations include add, remove, replace, move, copy, and test. Paths use JSON Pointer syntax (RFC 6901), such as /users/0/name. JSON Patch is widely supported across programming languages and is used in REST APIs (via the PATCH HTTP method), configuration management, and database migration systems.

Practical Use Cases

  • API versioning: Compare responses between API versions to identify breaking changes before deployment.
  • Configuration management: Diff environment-specific configs (dev vs. staging vs. production) to catch unintended differences.
  • CI/CD pipelines: Generate JSON Patches as build artifacts for automated deployment and rollback workflows.
  • Database migrations: Compare schema exports before and after migration scripts to verify correctness.
  • Code review: Understand the impact of changes to JSON fixtures, mock data, and configuration files.

Key Ordering and Normalization

JSON objects are unordered by specification (RFC 8259). Two objects with identical key-value pairs but different key ordering are semantically equal. When comparing configs generated by different tools or serializers, key order differences produce noise in text diffs. Sorting keys before comparison eliminates this noise and focuses the diff on actual value changes. This is especially important for generated configuration files where key order depends on the serialization library.

Array Comparison Strategies

Comparing arrays in JSON documents presents unique challenges because arrays are ordered collections. A simple index-based comparison works well for fixed-length arrays where each position has a defined meaning. However, when arrays represent sets of items (e.g., a list of users), an insertion at the beginning shifts every subsequent index, causing the diff to report every element as changed. More sophisticated algorithms address this by matching array elements using identity keys (such as an id field), similar to how React uses key props for list reconciliation. When using this tool, consider whether your arrays are positional (compare by index) or identity-based (where sorting or normalization before comparison produces cleaner results).

Integrating JSON Diff into Development Workflows

JSON diffing is most valuable when integrated into automated workflows. In code review, comparing the before-and-after state of JSON fixture files or configuration snapshots helps reviewers understand the impact of changes without reading raw file diffs. In CI/CD pipelines, generating a JSON Patch between environment configurations can serve as an audit log of deployment changes. Monitoring systems can diff periodic API response snapshots to detect schema drift or unexpected data changes in production. Some teams use JSON diff as part of contract testing — comparing actual API responses against expected baselines to catch regressions before they reach users.

RFC 7396: JSON Merge Patch

In addition to RFC 6902 JSON Patch, there is a simpler alternative: RFC 7396 JSON Merge Patch. A merge patch is itself a JSON document where each key represents a change — present keys with non-null values indicate additions or modifications, and keys with null values indicate deletions. Merge patches are easier to read and construct but cannot express array modifications, moves, or tests. They are best suited for simple object-level changes where array manipulation is not needed. Understanding the difference between JSON Patch and JSON Merge Patch helps you choose the right format for your specific use case.

Frequently Asked Questions

What is a JSON diff?

A JSON diff is a structural comparison between two JSON documents that identifies exactly which keys and values were added, removed, or changed. Unlike a text-based diff that compares lines, a JSON diff understands the hierarchical structure of objects and arrays, producing meaningful results even when keys are reordered or whitespace is reformatted.

Is my JSON data secure when using this tool?

Yes. Both JSON documents are processed entirely in your browser using JavaScript. No data is transmitted to any server, logged, or stored. This makes the tool safe for comparing API responses, configuration files, tokens, and any other sensitive JSON data.

What is JSON Patch (RFC 6902)?

JSON Patch is an IETF standard (RFC 6902) that defines a JSON format for describing changes to a JSON document. It uses operations like add, remove, and replace with JSON Pointer paths. The exported patch file can be applied programmatically in any language to reproduce the exact same changes.

How are arrays compared?

Arrays are compared by index position. Element 0 in the original is compared to element 0 in the modified document, element 1 to element 1, and so on. If one array is longer, the extra elements are reported as additions or removals. This index-based approach works well for ordered data like API response arrays.

What does the Sort Keys option do?

When enabled, Sort Keys normalizes the key order in both JSON documents before comparison. This eliminates false positives caused by different serialization orders. Two objects with identical key-value pairs but different key ordering will show no differences when Sort Keys is enabled.

Can I compare large JSON files?

Yes. There is no file size limit. Because processing runs entirely in your browser, the practical limit depends on your device's available memory. Most modern devices handle JSON documents of several megabytes without issues.

How do I read the diff output?

Green rows indicate values that were added in the modified document. Red rows indicate values that were removed from the original. Yellow rows show values that changed, displaying both the old and new values. Gray rows are unchanged. Nested objects and arrays can be expanded or collapsed to focus on specific sections.

Does the tool handle nested objects?

Yes. The diff algorithm recursively compares objects and arrays at every nesting level. Differences in deeply nested structures are reported with their full path (e.g., $.users[0].address.city), making it easy to locate the exact change in complex documents.

Learn more