Test · Developer

JSON Diff

Diff two JSON trees by path — locally, without uploading payloads.

  • changed · version

    left: 1

    right: 2

  • added · features[2]

    right: "units"

What is JSON Diff?

The JSON Diff tool compares two JSON documents structurally and reports what changed by path — additions, removals, and value changes. Unlike a text diff, it parses both sides into their JSON data model (per RFC 8259) and walks the trees, so reordered whitespace and formatting do not create false differences.

Paste a left and a right document; the tool lists each differing location using a path like user.roles[2] or address.zip, along with the old and new values.

Both documents are parsed and compared in your browser.

Why Use This Tool?

When an API response or config changes, you need to know which fields actually moved, not which lines reflowed. A structural diff pinpoints the exact paths that were added, removed, or changed, which a line-based diff cannot do reliably for JSON.

  • See semantic changes by JSON path.
  • Ignore formatting and whitespace noise.
  • Track drift between API versions or config snapshots.
  • Locate exactly which field changed and to what.

How Does This Tool Work?

The tool parses both inputs with JSON.parse and recursively compares them. At each node it checks equality; when values differ it records the path and classifies the change. Objects are compared by key: a key only on the right is added, a key only on the left is removed, and a shared key with different values is changed. Arrays are compared index by index.

Primitive equality uses strict identity (Object.is), so 1 and "1" differ, and structural type mismatches (object vs array) are reported as changes.

Understanding Your Results

Each result shows a path, a change type (added, removed, or changed), and the relevant left and/or right value. The root is shown as $ when the top-level values themselves differ in type or primitive value.

Because arrays are compared by index, inserting an item near the front shifts every following index and can report many changes even if the items merely moved. Treat arrays as positional data when reading the diff.

Why Tracking This Matters

Config and contract drift causes real outages. A precise, path-level diff makes it easy to review exactly what changed between two payloads or environments, catching an unintended field change before it ships.

Benefits of Using JSON Diff

  • Structural, path-based comparison
  • Ignores formatting differences
  • Classifies added, removed, and changed
  • Shows old and new values
  • Handles nested objects and arrays
  • Runs entirely in your browser

How Is the Result Calculated?

The tool recursively walks both trees. Two nodes that are Object.is-equal are skipped. If either side is not an object, or the two sides disagree on object-vs-array, the node is a change. Objects diff over the union of their keys; arrays diff over indices from 0 to the longer length, reporting overflow indices as added or removed.

Tips for Better Results

  • Remember arrays compare by index — moved items show as changes.
  • Note that 1 and "1" are different because comparison is type-strict.
  • Format both sides first if you want to eyeball them alongside the diff.
  • Use path output to jump straight to the changed field in your source.
  • For line-oriented text, use the Diff Checker instead.

Standards and References

Conclusion

JSON Diff compares two documents by structure and reports precise, path-level additions, removals, and changes, free of formatting noise.

It is the right tool for tracking API and config drift; for line-based text, reach for the Diff Checker instead.

Privacy & how it works

This developer utility runs in your browser with JavaScript and Web APIs. Your text, tokens, and secrets are not uploaded to The ToolSphere servers for this tool. Privacy Policy.

FAQ

How is this different from a text diff?expand_more

It parses JSON and compares the data structures by path, so formatting and whitespace never create false differences. A text diff compares lines regardless of meaning.

Is array order significant?expand_more

Yes. Arrays are compared element by element by index, so inserting or reordering items can register as multiple changes.

Does 1 equal "1" in the diff?expand_more

No. Comparison is type-strict (Object.is), so a number and a string with the same characters are reported as a change.

How are paths formatted?expand_more

Object keys use dot notation and array elements use bracket indices, for example items[0].name. The root is shown as $ when the top-level values differ.

What change types are reported?expand_more

Added (present only on the right), removed (present only on the left), and changed (present on both with different values or types).

What happens if one side is invalid JSON?expand_more

The tool reports a parse error and does not diff until both sides are valid JSON. Fix the invalid document first.

Does it detect moved keys?expand_more

Object key order does not matter for objects — only presence and value do. For arrays, position matters, so a moved array element appears as changes.

How are null and missing values treated?expand_more

A key set to null exists with value null; a missing key does not exist. Changing a value to null is a change, while removing the key entirely is a removal.

Can it compare large documents?expand_more

Yes, within your device's memory. The comparison runs in the browser, so very large trees are bounded by available resources.

Are my documents uploaded?expand_more

No. Both documents are parsed and compared in your browser and are not sent to The ToolSphere servers for this tool.

Is this tool free?expand_more

Yes. No signup and no paywall for core use.

Is my text uploaded?expand_more

No for this tool. Text stays in your browser while you work.

Suggest an improvement

Tell us what would make this tool more useful. We read every suggestion.

Feedback for: JSON Diff