Skip to main content
AllDevToolsHub
🔍

JSON Diff Viewer

100% Local

Compare two JSON objects and highlight semantic differences.

JSON Diff Viewer
No differences found, the JSON objects are identical.
Try:
This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.

Paste two JSON objects side by side. Added, removed, and changed fields highlight with color coding.

Overview

What is JSON Diff Viewer?

Paste two JSON documents and see a semantic diff showing added, removed, and changed properties with full paths. Handles nested objects and arrays cleanly.
FAQ

Frequently Asked Questions

Reference

Technical Deep Dive

JSON Diff Viewer

Paste two JSON documents and see a semantic diff showing added, removed, and changed properties with their paths. Handles nested objects and arrays. Copy a structured diff report for documentation.

Text diffs lie about JSON: key order and whitespace look like changes. This diff compares parsed structures so only real field deltas show.

Left {"id":1,"ok":true} vs right {"ok":true,"id":1} should be empty. Change ok to false and you get one field.

It will not tell you why an API started omitting a key. Pair it with the formatter when the paste is minified.

01 Difference Logic Matrix

Change Type Definition Visual Treatment Semantic Impact
AddedKey exists in Right but not LeftGreen HighlightNew metadata or resource field
RemovedKey exists in Left but not RightRed HighlightDeprecated or missing data
ModifiedValues differ for the same keyAmber HighlightData update or state transition
ReorderedSame keys in different sequenceIgnoredNo semantic difference (Spec-compliant)

02 Comparison Pipeline Workflow

1
Structural Parsing Both JSON inputs are parsed into JavaScript objects. Syntax errors are identified by line and column for immediate correction.
2
Tree Traversal The algorithm recursively walks both trees simultaneously, comparing every primitive value and structural branch.
3
Change Serialization Differences are mapped to canonical paths and formatted into a side-by-side visual report for diagnostic review.

03 When a Structural JSON Diff Is the Right Tool

Most diff tooling assumes line-oriented text. JSON is a tree, and once you treat it as one, several review and debugging tasks become dramatically faster. These are the cases that justify reaching for a structural diff instead of git diff or diff -u.

  • 🚦
    Staging vs production API responses Hit the same endpoint on two environments, paste both bodies side by side, and you see schema drift instantly: a field renamed, a nested array reshaped, a nullable that suddenly returns undefined. Line diffs lose the signal in re-ordered keys.
  • 🔒
    package-lock.json change review A "small" lockfile bump usually touches 200 lines but only a handful of resolved versions actually moved. A structural diff filters out the alphabetical reordering and surfaces the actual dependency changes (resolved URL, integrity hash, transitive promotions).
  • 🪞
    Config drift detection Two clusters of the same service, two slightly different configs. A semantic diff of the rendered config JSON tells you exactly which feature flag, timeout, or endpoint URL drifted, without making you read indentation.
  • 🧪
    A/B variant payload analysis Variant A returns one JSON shape, Variant B another. Diff the two responses to confirm that the only differences are the intended ones, and not, say, an unrelated experiment leaking a new analytics field into both arms.
  • 📜
    RFC 6902 / RFC 7396 patch authoring When you need to produce a JSON Patch (RFC 6902 add/remove/replace ops) or a JSON Merge Patch (RFC 7396), a structural diff is the natural starting point, every changed path becomes a patch operation.

04 Worked Examples

EXAMPLE 1 · API RESPONSE DIFF
Left (staging /v1/orders/42):
{"id":"42","status":"paid","total":1299,"customer":{"id":"c_1","email":"a@x.io"}}
Right (production /v1/orders/42):
{"id":"42","status":"fulfilled","total":1299,"customer":{"id":"c_1","email":"a@x.io","tier":"gold"},"shippedAt":"2026-05-20T10:00:00Z"}
Structural diff:
~ status:        "paid" → "fulfilled"
  • customer.tier: "gold"
  • shippedAt: "2026-05-20T10:00:00Z"

Three real changes surface immediately. A textual diff would have flagged the entire customer object as changed simply because new fields shifted positions.




EXAMPLE 2 · ARRAY DIFF: INDEX vs CONTENT MATCHING

Left:

{"tags":["alpha","beta","gamma"]}

Right:

{"tags":["beta","alpha","gamma"]}

Index-based diff (default, order matters):

~ tags[0]: "alpha" → "beta"

~ tags[1]: "beta" → "alpha"


Index-based matching aligns with RFC 6902 semantics, arrays are sequences, not sets. For set-like data (permissions, tags), switch to content-based matching to report no change. Choosing the right mode is a domain decision, not a tool default.




EXAMPLE 3 · null vs MISSING KEY (THE CLASSIC TRAP)

Left:

{"email":"a@x.io","phone":null}

Right:

{"email":"a@x.io"}

Diff (RFC 7396 Merge Patch semantics):

- phone: null     // key removed

RFC 7396 treats null as the removal sentinel in merge patches, which is the opposite of how RFC 6902 ("remove" op vs "replace with null") treats it. The diff distinguishes "key absent" from "key present, value null", a distinction that bites every API team that conflates the two.




05 Related Tools

Diffing JSON is usually a step in a larger workflow, formatting, schema validation, or patch generation. Pair this tool with the rest of the JSON toolchain.

You Might Also Need