DevBolt
Processed in your browser. Your data never leaves your device.

How do I compare two JSON objects online?

Paste the original JSON on the left and the modified JSON on the right, then click Compare. The tool shows structural differences — added keys, removed keys, and changed values — in a tree view with color coding. Expand or collapse nodes to focus on specific changes. Everything runs in your browser.

Detect value change
Input
Left:  {"name":"Alice","age":28}
Right: {"name":"Alice","age":29}
Output
~ age: 28 → 29
1 change found
← Back to tools

JSON Diff

Compare two JSON objects and see structural differences — added, removed, and changed keys highlighted.

About JSON Diff

This tool performs a deep structural comparison of two JSON documents. Unlike a plain text diff, it understands JSON semantics — comparing objects by key and arrays by index, so reordering whitespace or formatting won't produce false differences.

Added keys exist only in the right document. Removed keys exist only in the left. Changed keys exist in both but have different values. Nested objects and arrays are traversed recursively, showing the full JSON path to each difference.

Use Tree view to inspect each difference interactively, or Raw view for a compact, copy-friendly summary. Press Ctrl+Enter to compare.

Tips & Best Practices

Pro Tip

Sort object keys before diffing for meaningful comparisons

JSON object key order is not guaranteed by the spec. Two semantically identical objects with different key ordering will show as completely different in a naive diff. Sort keys alphabetically before comparing to focus on actual value changes rather than ordering noise.

Common Pitfall

Array diffs are order-sensitive by default

Moving an item from index 0 to index 5 in a JSON array appears as a deletion and an addition, not a move. If your arrays represent unordered sets (e.g., tags, roles), sort them first. For ordered sequences (timeline events), the positional diff is correct.

Real-World Example

Compare API responses across environments

Diff the JSON response from staging vs production for the same endpoint to catch environment-specific bugs: missing fields, different default values, or schema version mismatches. This is faster than manually reading two large response bodies.

Security Note

Diff config files before deploying to catch unintended changes

Before deploying updated Kubernetes manifests, Terraform state, or application config, diff the old vs new JSON/YAML. This review step catches accidental permission escalations, removed security headers, or disabled authentication flags that might slip through in large config files.

Frequently Asked Questions

How does JSON diff differ from a regular text diff?
A JSON diff compares the semantic structure and values of two documents, while a text diff compares raw lines. JSON diff understands that objects with reordered keys are identical. It reports differences as specific operations on key paths: added, removed, or changed at $.path.to.field. It handles nested objects and arrays intelligently, showing exactly which property changed rather than marking entire blocks as different.
How does the tool handle array comparisons?
Array comparison uses index-based matching — element [0] in the first document is compared to element [0] in the second. This works well for ordered arrays where position matters. DevBolt's JSON Diff provides clear output showing which array elements were added, removed, or modified at each index. For complex comparisons, consider structuring your data so arrays contain objects with ID fields for easier tracking of additions and removals.
Can I compare minified JSON with formatted JSON?
Yes, JSON diff compares parsed data structures, not raw text. A minified single-line string and a beautifully formatted version produce identical parse trees, so the diff correctly shows zero differences. This is a key advantage over text-based diffing, which would flag every line as changed. Only actual data differences — changed values, added keys, or removed keys — appear in the results.

Related Inspect Tools