JSON Diff (Semantic Compare)

Compare two JSON documents by structure rather than text: key order is ignored, every difference is listed with its JSONPath, and a JSON Patch is generated.

Last updatedHow we build & check our tools
Results will appear here once you enter your values.

Why a text diff is the wrong tool for JSON

RFC 8259 defines a JSON object as an unordered collection of name/value pairs, and insignificant whitespace can appear anywhere. Two API responses can therefore be byte-for-byte different and still carry identical data: one serializer writes {"id":1,"name":"a"}, another writes the keys in the opposite order with two-space indentation. A line-based diff, like the Diff Checker on this site, reports every one of those lines as changed.

This tool parses both sides first and compares the resulting values. Reordered keys and reformatting produce no differences at all, and what remains is the data that actually changed. That makes it the right choice for comparing API responses between environments, reviewing config file changes, checking a migration's output against a snapshot, or verifying that a refactor of a serializer did not change its output.

Reading the results

Each difference is listed with a JSONPath such as $.dimensions.w or $.items[2].sku. Keys that are not valid identifiers use bracket notation, for example $["content-type"].

  • Added: the path exists only on the right.
  • Removed: the path exists only on the left.
  • Changed: same type, different value, such as 19.99 to 24.99.
  • Type changed: the JSON type differs, such as the number 19.99 becoming the string "24.99", or null becoming 0. These are often the bugs that break typed clients, so they are called out separately.

A key set to null is not the same as a missing key; the diff reports the difference because many APIs treat them differently.

Arrays are compared by position by default, which is correct for ordered lists such as steps or coordinates. Choose Ignore order for sets such as tags or permission lists; elements are then matched by value (duplicates are counted), and only elements with no match are reported.

Using the JSON Patch output

In position mode the tool also writes an RFC 6902 JSON Patch: a list of replace, remove and add operations that turns the left document into the right one. Paths use JSON Pointer (RFC 6901), where / inside a key is escaped as ~1 and ~ as ~0. Array removals are ordered from the highest index down, because removing index 2 first would shift index 3 out from under the next operation.

You can send the patch to APIs that accept application/json-patch+json (Kubernetes, Azure, ASP.NET Core and many REST services), or apply it with libraries such as fast-json-patch. The patch is omitted in Ignore order mode, because an order-insensitive diff does not define where elements should be inserted.

Frequently Asked Questions

Common questions about the JSON Diff (Semantic Compare)

Yes. Objects are compared key by key regardless of order, as the JSON specification treats them as unordered. Formatting and indentation are also ignored because both sides are parsed before comparing.
From the same team

Turn your GPU into an OpenAI-compatible API endpoint

Wide Area AI routes your LLM API calls to your own hardware over a Cloudflare Tunnel — free local inference with edge caching and automatic cloud failover. Works with any OpenAI SDK.

Start routing — free

Sources & References

RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format

Objects are unordered collections of name/value pairs

RFC 6902: JavaScript Object Notation (JSON) Patch

add, remove and replace operations in the generated patch

RFC 6901: JavaScript Object Notation (JSON) Pointer

Pointer syntax and ~0 / ~1 escaping used in patch paths

RFC 9535: JSONPath: Query Expressions for JSON

JSONPath notation used to label each difference