JSON Compare

Compare two JSON documents semantically in your browser: key-order and whitespace-insensitive, type-aware, with exact number literals and RFC 6901 paths.

  • Runs locally in your browser
  • No upload required

Capabilities

  • Keyboard shortcuts
  • Drag and drop
  • Local file intake
  • Download result
  • Advanced options

Try it

  • Key order is ignored by default; turn it on to report order changes.
  • Key arrays match items by the identity property, so reordering is ignored.

Paste two JSON documents to compare them.

The change list appears here after a comparison.

Supported formats

Input
text, file
Output
text, json
Files
Local file intake and drag/drop

Privacy

Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.

Processing
In your browser
Privacy level
Browser only

The two documents are semantically equal under the current options.

How it works

  • Parse both documents with the verbatim JSON scanner, keeping every number literal exact.
  • Compare the parsed trees: object members are matched by key, arrays by index or by a chosen identity property.
  • Classify every leaf difference as added, removed, changed or type-changed, and address it with an RFC 6901 JSON Pointer.
  • Count the result: +0 added, −0 removed, ~0 changed, ≠0 type-changed.
  • Formatting and, by default, key order are ignored because the comparison works on the parsed tree, not the text.
  • Types are respected: the number 1 and the string "1" are different. Number literals compare exactly, so big integers are never corrupted.
  • Nothing leaves your browser: there is no upload, no account and no share link.

Methodology

  1. Both documents are parsed with the same purpose-built scanner the JSON Formatter uses. It preserves every number literal verbatim, so values beyond `Number.MAX_SAFE_INTEGER` are compared exactly and never coerced through `JSON.parse`.
  2. Because the comparison runs on the parsed tree, whitespace and indentation can never produce a difference; documents that differ only in formatting compare equal.
  3. Object members are matched by their decoded key, so key order is ignored by default. The order-sensitive option reports a differing key sequence once at the object's path instead of cascading a positional diff.
  4. Every node carries a type (object, array, string, number, boolean, null). A path whose type differs is reported as `type-changed` (for example the number `1` versus the string `"1"`), and is not recursed into.
  5. Arrays compare by index by default. The key strategy matches items by a chosen scalar identity property; reordered items with the same identity compare equal, matched items are compared recursively, and unmatched identities are added/removed.
  6. Each difference is addressed with an RFC 6901 JSON Pointer (`/a/b/0`, with `~0`/`~1` escaping) using the same pointer helper as the JSON Explorer.
  7. Comparison runs in the browser and is offloaded to a worker above a documented size threshold; the page states the tested limit.

Usage

  1. Paste, type, drop or pick the original JSON in the left editor, then the changed JSON in the right one.
  2. Press Compare JSON (or use the keyboard shortcut) to run the comparison; it also runs after a short debounce as you edit.
  3. Leave Key order off to ignore member order, or turn it on to report a key-order difference at the object path.
  4. Choose the array strategy: Index pairs items positionally; Key matches items by the identity property you name.
  5. Read the path-level change list: each row shows an RFC 6901 pointer and is classified added, removed, changed or type-changed.
  6. Use Swap sides, Load sample or Clear to manage the workspace.
  7. Copy or download the change list; everything is generated locally and never uploaded.

Examples

These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.

Formatting-only difference

jsonSelect to copy
{
  "original": "{\"b\":2,\"a\":1}",
  "changed": "{\n  \"a\": 1,\n  \"b\": 2\n}"
}

Different key order and indentation compare equal: zero differences.

Type change and an added key

jsonSelect to copy
{
  "original": "{\"id\":1,\"name\":\"a\"}",
  "changed": "{\"id\":\"1\",\"name\":\"a\",\"active\":true}"
}

The number/string mismatch is type-changed at /id and the new member is added at /active.

Limitations

Why a semantic JSON compare

Text diff tools are the wrong instrument for JSON: they report indentation and key order as changes and can mistake a reformatted document for a rewrite. A structural comparison asks the question a developer actually has — which values, at which paths, changed.

This tool parses both documents and compares the trees, so only real differences are listed, each one addressed by an RFC 6901 pointer you can act on.

Exact numbers, honest types

The engine never routes your document through a native JSON.parse. It uses the project's verbatim scanner, which keeps every number literal exactly as written and preserves types distinctly.

That is why a 64-bit identifier survives a comparison intact, and why the number 1 and the string "1" are never silently treated as equal.

Path-level results

Every difference is a row: an RFC 6901 JSON Pointer, a classification (added, removed, changed or type-changed) and the original and changed values.

The pointer format matches the JSON Explorer, so you can paste a path straight into a validator, a patch tool or a query.

Local-only by construction

Processing uses the pure engine in this project, off the main thread above a size threshold. There is no remote service, no third-party script and no content in a URL, log or analytics event.

The workspace stores nothing: there is no persistence key for this tool, and Clear removes the documents from the page.

Frequently asked questions

Is my JSON uploaded anywhere?
No. The comparison runs entirely in your browser using the local engine. There is no upload, no account, no share link and no server round trip; an automated network monitor proves that typing and comparing produce no outgoing request.
Why do two documents with different key order compare equal?
JSON objects are unordered, so the tool matches members by key by default and ignores their order. Turn on Key order if you want a key-order difference reported at the object's path.
Does it treat 1 and "1" as the same?
No. The comparison is type-aware: the number 1 and the string "1" have different types, so the path is reported as type-changed with both types shown.
Will it corrupt large integers?
No. It uses the same verbatim scanner as the JSON Formatter, which keeps every number literal exactly as written, so values like 9007199254740993 are compared without the precision loss of a native JSON.parse.
How does the key-based array strategy work?
You name a scalar property (for example id). Items are matched by that value, so an array that was reordered but not changed compares equal. Items without the property fall back to index pairing, and duplicate identity values fall back to index for the whole array.
What is a JSON Pointer path?
Each difference is addressed with an RFC 6901 JSON Pointer such as /users/0/name, with the escaping rules ~0 for ~ and ~1 for /. It is the same path format the JSON Explorer uses, so you can locate the value directly.
What happens with very large documents?
Above the documented size threshold the comparison runs off the main thread in a worker so the page stays responsive. Past the hard limit the tool shows a clear message instead of freezing or truncating.
Are there ads in the comparison workspace?
No. Ads only ever appear in approved slots around the tool page, never between the editors, over the result or next to the primary action.

Sources

  1. RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format — IETF
  2. ECMA-404 — The JSON Data Interchange Syntax — Ecma International
  3. RFC 6901 — JavaScript Object Notation (JSON) Pointer — IETF