Canonical JSON equivalence prover. Paste two JSON documents that should mean the same thing — different key order, whitespace, or number formatting — and get a byte-identical canonical hash if, and only if, they truly encode the same data. If they don't, it points at exactly where they diverge.
runs offlinesingle file, no serverno AI judgeSHA-256 via crypto.subtlethird-party re-runnable
Start here
Kar-Canon tells you whether two JSON documents carry exactly the same data, however they are formatted, and where they differ when they do not. It runs entirely in this page: nothing you paste is sent anywhere, and no AI judges anything.
Paste document A and document B above, or press one of the Load example buttons.
Press Canonicalize & compare.
Read the verdict: MATCH means the same data; DIFFER lists every path where a value was added, removed or changed.
Keep the fingerprints: the SHA-256 of each canonical form, which anyone can recompute.
AI pipelines re-serialize the same structured decision (a tool call, a policy verdict, a cached response) through different libraries, languages, and formatters. Key order shifts, whitespace changes, 1.50 becomes 1.5 — and a naive string or byte comparison flags a false mismatch, or worse, a naive "looks similar" check misses a real one.
kar-canon converts each document to a single, fully-specified canonical byte string (closely following RFC 8785, the JSON Canonicalization Scheme), hashes it with SHA-256, and compares hashes. Anyone — in any language — can re-implement the algorithm below and reproduce the identical hash from the identical data. There is no model in the loop and nothing to trust but the arithmetic.
Limits: what it does not check
Not schema validation. This does not check whether a document is well-formed as an API contract expects (that's a JSON Schema conformance job) — only whether two documents are byte-for-byte the same once whitespace, key order, and number spelling are normalized.
Arrays stay order-sensitive, on purpose.["a","b"] and ["b","a"] are different data and will correctly report DIFFER. Only object key order is normalized, because JSON objects are unordered maps and arrays are ordered sequences.
Very large or very precise numbers are rounded. Whole numbers above 9,007,199,254,740,992 (253), and decimals with more than about 17 significant digits, are rounded to the nearest value JavaScript can hold when the file is read, as in any tool built on JSON.parse. So 12345678901234567890 and 12345678901234567000 MATCH. If exact digits matter (long IDs, money in minor units), carry them as strings, not bare numbers.
Duplicate object keys resolve last-value-wins, matching standard JSON.parse behavior. The JSON spec itself does not mandate this — a different parser could legally pick first-wins. Don't rely on duplicate keys in data you intend to canonicalize.
No Unicode normalization.é as one code point (U+00E9) and é as "e" + combining accent (U+0065 U+0301) are different strings and will correctly report DIFFER, even though they render identically. That is a deliberate choice, not a bug — but it can surprise you.
Getting the same fingerprint in another language means following the algorithm below exactly. Libraries differ from it by default. Python's json.dumps, for one, adds spaces after commas and colons, writes 1.0 where this writes 1, and writes é as the escape \u00e9 unless told not to (ensure_ascii=False). Any one of these gives a different fingerprint for the same data.
This implementation has not been run against the full RFC 8785 conformance suite — treat it as "closely aligned," not a certified implementation.
Algorithm — reproduce this hash yourself
Parse the input as JSON (RFC 8259). Reject on parse failure.
Canonicalize recursively:
null, true, false → the literal token.
number → the ECMAScript Number::toString form (shortest round-tripping decimal any compliant JS engine produces); negative zero canonicalizes to 0.
string → a JSON string literal with only the mandatory escapes (", \, and control characters U+0000–U+001F); every other code point is emitted as literal UTF-8, unescaped.
array → [ + canonicalized elements, comma-separated, original order preserved + ].
object → keys sorted by UTF-16 code unit order, duplicates resolved last-wins, then { + "key":value pairs, comma-separated, no extra whitespace + }.
UTF-8 encode the resulting canonical string.
SHA-256 the bytes; render the digest as lowercase hex.
Compare two documents
SHA-256(canonical A)
—
SHA-256(canonical B)
—
Show canonical bytes — AShow canonical bytes — B
Where they diverge
Path
Change
A
B
Self-test
Ten built-in cases exercise the exact same canonicalize / hash / diff functions used above — including one that must verify (equivalent documents, superficially different) and one that must be caught (a tampered value). Nothing here is hand-picked after the fact: the assertions and the engine are the same code that runs your input above.
How it works
Each document is parsed and rewritten in one canonical form, aligned with RFC 8785: keys sorted, every number and string in one spelling, no whitespace.
Each canonical form is hashed with SHA-256. Equal hashes mean equal data, whatever the formatting, key order, number spelling or escapes.
When they differ, it walks both documents and lists every path where they part.
Words on this page
Canonical form
One agreed way of writing the same data: keys in sorted order, no spaces, each number and string in one spelling. {"b":1, "a":1.50} becomes {"a":1.5,"b":1}.
Path
Where a value sits in the document: $.order.items[2].price is the price of the third item in the order.
Kernel
The small piece of code that decides every verdict; the rest of the page only shows what it decided. Here it is the block inside this page, copied byte for byte into kernel.mjs (the file the tests run) and into the script, so all three are the same code.
SHA-256 receipt
A 64-character fingerprint of the input and the verdict. Anyone with the same input gets the same fingerprint; change one character and it changes completely.
Deterministic
No AI model, no random numbers and no clock go into a verdict, so the same input gives the same verdict on any machine, every time.
No AI judge
No language model decides anything. The verdict comes from fixed rules you can read in kernel.mjs.
Mutation gate
A test of the tests. witness makes small deliberate changes to the kernel, one at a time: for example it turns if (count > 0) into if (count >= 0), then runs the tests. Every change must make a test fail. A change no test notices has survived: it would mean no test checks what happens at that exact point. A change reviewed as equivalent cannot alter any result (both versions give the same answer for every input), and the reason is written down and checked.
CI
Continuous integration: GitHub re-runs every test and the gate on its own computers on every change, and the runs are public.
In the browser
The page does the work on your computer. Nothing you paste is sent to a server.
MIT licence
An open-source licence: you may use, copy, change and build products with it, free, as long as the copyright notice stays.
Sourced figures
Every number in the cost case comes from a published source (the UK median wage and UK inflation, from the ONS), linked under the table.
Blueprint
One source of truth. The checking logic is the KERNEL block inside this page. build.mjs copies it byte for byte into kernel.mjs (which the tests and the mutation gate run) and into scripts/kar-canon.mjs (the one-file agent skill). CI fails if the three ever differ, so the page you use, the code that is proven and the script an agent runs are the same code.
Tests.kernel.test.mjs tests the kernel; skill.test.mjs runs the shipped script on its own, the way an agent platform runs it, against the expected outputs in examples/.
Mutation gate.witness makes one small change to the kernel at a time (a < becomes <=, an && becomes ||) and re-runs the tests. Every change must make a test fail: that proves the tests check each of those points, rather than just running the code (see Mutation gate in Words on this page). From receipts/witness.json: reading the receipt…
The cost case below is calculated by a separate small piece of code, checkcase.mjs, tested and mutation-gated in the same way as the kernel, in its own CI job. It uses only published figures (the UK median wage and UK inflation), each linked under the table.
CI re-runs all of it on GitHub's computers on every change: every run, in public.
Roll it out
Pick one place where this check is done by hand today, or skipped, and the person who owns it.
Try it here on real examples from that place. Nothing leaves the page.
Put it in the flow. Run node scripts/kar-canon.mjs a.json b.json in CI or a script (Node.js 20 or later, no dependencies). Exit code 0 means MATCH, 1 means DIFFER, 2 means the input could not be read. An AI agent can run the same script as a skill.
Keep the receipts with the work they checked, so anyone can recompute a verdict later.
Measure the difference with the cost case below.
For a business
Kar-Canon turns a check that is usually done by eye, or not at all, into a verdict anyone can recompute: the same input gives the same answer and the same SHA-256 receipt on any machine, with no AI judging it.
CEO. A change that matters (an amount, a permission, a flag) cannot hide inside a reformatted file.
CFO. Reviewing JSON changes by eye becomes a verdict in seconds; the case below works it out on your volumes. MIT open-source licence, no licence fee.
COO. One step in review or CI: two files in, MATCH or DIFFER out, exit code 0 or 1.
CTO / CISO. No AI judge and no network: the same input gives the same verdict and fingerprint on any machine. Its tests are themselves tested by a mutation gate (see Words on this page); the code is kernel.mjs, in public.
Legal and compliance. A fingerprint anyone can recompute is evidence of exactly what changed, and when nothing did.
The teams. Reviewers see the one real change instead of every line a formatter touched.
The cost case, on your numbers
What the checking costs today against running the tool. Staff time is at the UK median hourly wage with on-costs left out, so this is a floor; later years rise with UK inflation (CPI). Change any box to your own numbers and the table recalculates as you type.
How it is worked out. Today: checks a year (per week × 52) × minutes per check × the median hourly wage, plus anything you pay for a tool now. With the tool: the share it replaces takes the seconds you enter instead of the minutes, and the rest is still checked by hand. Each later year rises by one more year of inflation.
year
checking by hand
with Kar-Canon
saved
Against what you do now
A text diff. It shows every reformatted line, so the one real change hides among them.
Reading both files by eye. Slow, and it misses a changed value in a long file.
Asking an AI model. Its answer is not reproducible and cannot be recomputed by anyone else.
Security, data protection and deployment
The page runs entirely in your browser; nothing you paste is sent anywhere. It can be served from your own intranet unchanged.
The script is one file with no dependencies and makes no network calls; it runs on Node.js 20 or later, on any machine or CI runner.
Deterministic: no AI model, no random numbers and no clock go into a verdict, so the same input gives the same verdict on any machine. The receipt hash lets anyone re-check a result.
Support and ownership
Supplied by AI Native Solutions; start through that site. Support, any service level, warranty and liability are agreed per deployment, in each deployment's agreement. The software is MIT and keeps running without us.
Where it stops, answered straight
Arrays are compared in order, by design.["a","b"] and ["b","a"] DIFFER.
Very large or very precise numbers. Integers beyond 2^53 and decimals with more than about 17 significant digits are compared after rounding to the nearest double.
Not the full RFC 8785 suite. It has not been run against the complete conformance suite.
Sameness, not correctness. It does not check either document against a schema; kar-conform does.
The case for the board
A check that anyone can recompute replaces a check that has to be trusted, at no licence cost, without sending your data anywhere. Its logic is the code on this page, and its tests are themselves tested.
FAQ
Is it the same as a text diff?
No. A text diff compares characters; this compares data. Two files that differ only in formatting, key order or number spelling MATCH.
Can an agent run it?
Yes. The same kernel ships as a one-file Node.js script (scripts/kar-canon.mjs) with no dependencies, usable as an agent skill or a CI step.
What happens with bad, empty or very large input?
Text that is not valid JSON is refused with the parser's own message (the script exits 2); nothing is guessed. Numbers too large or too precise for a double are rounded first (see Limits). JSON nested more than about 2,500 levels deep stops with an error (the script exits 3), never with a verdict. There is no size cap beyond your machine's memory.
What do I need to run it?
For the page, a modern browser; there is nothing to install. For the script, Node.js 20 or later (free from nodejs.org; node --version shows which one you have): download scripts/kar-canon.mjs (one file, no dependencies, no npm install) and run it with no arguments to see how to call it.
Does it need the internet or an account?
No. The page works once loaded, and the script runs offline. Nothing is uploaded.