Skip to content

JSON Diff

Compare two strict JSON values structurally and receive deterministic added, removed, changed, and type-changed entries at JSON Pointer paths.

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

How to use

  1. 1.Paste strict left and right JSON documents; formatting and object member order may differ.
  2. 2.Compare and inspect each added, removed, changed, or type-changed RFC 6901 path and value.
  3. 3.Copy the change list for review, but use a dedicated patch implementation and tests before applying changes automatically.

About JSON Diff

JSON Diff compares two strict JSON documents as parsed data rather than as formatted text. Paste a left value and a right value, run the comparison, inspect a concise path list, and copy the structured change array. Whitespace and object member order do not create noise, while real value, type, key, and positional array changes remain visible.

Both inputs use strict RFC 8259 parsing. Comments, trailing commas, undefined, NaN, Infinity, BigInt syntax, and JavaScript object literals are rejected. Each side can be any JSON value: object, array, string, number, Boolean, or null. The root path is the empty JSON Pointer and is displayed as root in the human-readable list when the entire value changes.

Objects are compared by their own member names without depending on source order. Keys are sorted for deterministic reporting. A key found only on the right is added; a key found only on the left is removed. A key present on both sides is compared recursively. Duplicate names in JSON text cannot be compared as separate entries because normal JSON parsing resolves them before this tool receives the object mapping.

Arrays are ordered sequences and are compared by zero-based position. If values move from one index to another, the result can contain a removal, addition, or multiple changed entries rather than a semantic move. The tool does not guess identity keys, compute a longest common subsequence, or treat arrays as sets. Those policies depend on the data contract and can hide meaningful ordering changes.

Every location is an RFC 6901 JSON Pointer. A slash inside a member name becomes ~1 and a tilde becomes ~0. Array positions use decimal index tokens. The root is represented by an empty string, not a slash. Paths identify where the comparison observed a difference; they are not automatically an executable patch or a guarantee that applying an operation will create the right document.

A primitive with the same JSON type but a different value is changed. A number becoming a string, an object becoming an array, or null becoming another type is type-changed. Added entries include the right value, removed entries include the left value, and changed entries include both. Object and array subtrees can appear as values when a whole member is added, removed, or changes type.

JSON numbers are parsed as JavaScript Numbers. Integers beyond the safe range and fine decimal distinctions may already be rounded before comparison. Positive and negative zero compare as the same JSON numeric value. If exact decimal spelling, duplicate names, or arbitrary-precision numbers matter, compare the source with a parser and numeric model designed for that contract instead of relying on this browser representation.

The result is a product-defined change list, not RFC 6902 JSON Patch, JSON Merge Patch, a text unified diff, or a schema migration. It does not emit move, copy, or test operations, and it does not claim that a removed value can be restored after surrounding changes. Use a maintained patch library and application-specific tests when changes will be applied automatically.

Each input is limited to 500,000 characters, nesting to 50 comparison levels, and output to 5,000 changes. The tool fails instead of truncating a larger result. Eight external fixtures cover changed, added, removed, type-changed, array index, slash escaping, tilde escaping, and object-order equality. Additional tests cover deterministic nested changes and signed zero. Review sensitive before and after values before copying the change list into logs or tickets.

Methodology & sources

Parses both strict JSON values, recursively compares objects by sorted own keys and arrays by position, classifies added/removed/changed/type-changed entries, escapes paths as RFC 6901 JSON Pointers, treats object order as irrelevant, and fails rather than truncating limits.

Frequently asked questions

Why does changing object key order show no difference?
RFC JSON objects are unordered collections. This tool compares member names and values, not their source-text order.
Why does reordering an array create several differences?
Arrays are ordered and compared positionally. The tool does not invent item identities or move detection.
Is the copied output JSON Patch?
No. It is a review-oriented change list with before and after values. It does not implement RFC 6902 operations or patch application semantics.

Developer Tools guides

View all