# What is JSON Canonicalization Scheme?

> The JSON Canonicalization Scheme (JCS) is a fixed recipe for writing JSON data as one exact string of bytes, so two systems that hash or sign the same data get the same result.

Explainer by Boston Identity, 2026-10-28. 6 min read. https://insights.bostonidentity.com/glossary/jcs

- What it is: standard
- Defined by: RFC 8785, Informational, not IETF standards track
- Who it's for: Teams signing or hashing JSON records

## What is JSON Canonicalization Scheme?

JSON (JavaScript Object Notation) lets the same data be written many ways. Spaces, the order of property names and the spelling of a number can all change while the meaning stays put. A hash or a signature sees only bytes, so two systems that write the same record differently get different results [S1 §1].

JCS fixes one way to write it. It builds on the rules JavaScript's own standard, ECMAScript, uses to print strings, numbers and literals, limits data to I-JSON (Internet JSON, a stricter subset), and sorts property names in a fixed order [S1 §1]. The authors' point is that the data can travel in its original form while each end computes over the same canonical bytes, so a JSON object stays a JSON object after it is signed [S1 §1].

RFC 8785 is an Independent Submission published for information. It is not an IETF standard, and the RFC Editor says it makes no statement about its value for deployment [S1]. Its authors still use MUST and SHOULD in the usual way, and say a conformant implementation is supposed to follow them [S1 §2].

Think of it like this: Think of two clerks who must file the same form so that a photocopy of each matches exactly: JCS is the rulebook that says which box comes first, how to write each number and where not to leave spaces. It stops working as an analogy at meaning: JCS never decides whether two different values mean the same thing, only how to write the value it is given.

Not the same as: Not a signature format. JCS only produces the bytes; a separate signing scheme signs them and says where the signature goes [S1 App. F]. Nor is it the approach of JSON Web Signature (JWS), which signs a base64url-encoded copy of the data instead [S1 §1].

## How does JSON Canonicalization Scheme work?

Three parties take part: a producer that creates or receives the data, a canonicalizer that turns it into fixed bytes, and a receiver that checks a hash or signature over those bytes. The receiver runs the same canonicalizer on its side.

[Figure: The canonicalizer turns the producer's JSON into one fixed string of UTF-8 bytes, and the receiver rebuilds the same bytes before it trusts the signature.]

1. **The producer prepares the data.** The data may come from parsing earlier JSON or from a program. Either way it must fit I-JSON: no duplicate property names, strings expressible in Unicode, and numbers expressible as IEEE 754 double-precision values (the standard 64-bit floating-point format). Parsed strings must not be altered, and Unicode text must be kept as is, with no normalization [S1 §3.1].
2. **The canonicalizer drops whitespace.** No whitespace may be emitted between JSON tokens, so indentation and line breaks disappear [S1 §3.2.1].
3. **The canonicalizer writes each value one way.** The literals null, true and false are written as such. Strings get a fixed set of escapes, and every other character is written as is. Numbers follow the ECMAScript rule, so 4.50 becomes 4.5 and 1E30 becomes 1e+30. NaN, Infinity and invalid Unicode such as a lone surrogate must stop the canonicalizer with an error [S1 §3.2.2].
4. **The canonicalizer sorts property names.** Property names are sorted at every level, including objects inside arrays. The sort compares names as UTF-16 code units, treated as plain unsigned numbers, regardless of locale. The order of array elements must not change [S1 §3.2.3].
5. **The canonicalizer outputs UTF-8 bytes.** The result must be encoded in UTF-8, and those bytes are the input to the hash or signature [S1 §3.2.4]. In the signing scheme the RFC sketches, the producer signs the canonical bytes and adds the signature value to the original JSON in a designated property [S1 App. F]. The canonical form does not have to be what travels on the wire [S1 App. C].
6. **The receiver checks before acting.** Before acting on signed data, the receiver must parse it and confirm it is I-JSON, check it against the conventions of its own system, including where the signature sits, and then verify the signature. If any step fails, the operation must be aborted [S1 §5]. In the RFC's sketch, the receiver removes the signature property, canonicalizes the rest and verifies the signature over that [S1 App. F].

## Why does JSON Canonicalization Scheme matter now?

Several of the AI agent drafts we have been reading at the IETF this year depend on canonical JSON, and two name JCS outright. Schrock's Canonical Action Identifier, which gives permits and receipts one name for an agent action, makes JCS with SHA-256 its required suite [BI-FIND-2026-0956](https://insights.bostonidentity.com/ref/BI-FIND-2026-0956). Gilda's agent audit record signs RFC 8785 canonical bytes, and members a verifier can recompute catch an edit even by the key holder [BI-FIND-2026-0510](https://insights.bostonidentity.com/ref/BI-FIND-2026-0510). Another draft's Capsule ID is a SHA-256 hash over the record's canonical JSON [BI-FIND-2026-1158](https://insights.bostonidentity.com/ref/BI-FIND-2026-1158).

Coetzee's draft shows what rides on it. It lets a short-lived agent token carry a SHA-256 digest of the canonical JSON of the tool, its parameters and the target, though that binding is optional, a MAY on each leaf token. The enforcement point recomputes the digest over the call actually made and refuses on a mismatch [BI-FIND-2026-0524](https://insights.bostonidentity.com/ref/BI-FIND-2026-0524). He ranks canonicalization mismatch first among his design's risks: if the two sides serialize the same call differently, he writes, a divergence is a full authorization bypass [BI-FIND-2026-0525](https://insights.bostonidentity.com/ref/BI-FIND-2026-0525).

We read this as a shift in where the risk sits. Where a design like Coetzee's is deployed, the control holds only if the agent side and the enforcement point canonicalize the call byte for byte alike [BI-FIND-2026-0525](https://insights.bostonidentity.com/ref/BI-FIND-2026-0525).

## Where does it fit?

- Compared with JSON Web Signature: JSON Web Signature avoids the problem another way: it encodes the payload in base64url, a fixed form, and signs that [S1 §1]. JCS instead keeps the data as readable JSON and signs a canonical copy of it.
- Compared with ES256: JCS defines no signature algorithm of its own; it only fixes the bytes that a hash or signature is computed over [S1 §1].

## What goes wrong?

- Two canonicalizers that disagree produce different bytes for the same data, so a hash or signature made on one side fails on the other. The RFC leaves the number algorithm to ECMAScript and points to V8 and Ryu as references, and it supplies sample values to test against [S1 §3.2.2.3, App. B]. Sorting is another trap: for names like those in the RFC's non-ASCII test data, sorting by UTF-8 or UTF-32 instead of UTF-16 code units gives a different order that is incompatible with JCS [S1 §3.2.3]. JCS also borrows its value rules from ECMAScript; if a future ECMAScript changed them, the RFC leaves developers to keep to RFC 8785 or write a new specification [S1 §3.2.2]. For an agent token tied to one call, one author ranks such a mismatch as a full authorization bypass [BI-FIND-2026-0525](https://insights.bostonidentity.com/ref/BI-FIND-2026-0525).
- Parsers can quietly change data. A parser that turns a string into a date or big integer and back may print "055" as "55" or add milliseconds to a time, and the signature then fails. Stream- and schema-based parsers must treat such values as plain strings [S1 App. E].
- Numbers beyond double precision lose accuracy. The RFC recommends carrying higher-precision numbers and long integers as JSON strings [S1 §3.1]. Numbers with no natural place in JSON must be wrapped as strings, and the RFC notes that money would presumably not rely on floating point [S1 App. D].
- The RFC asks for sanity checks on input to avoid buffer overflows and similar damage [S1 §5].
- Canonical bytes say nothing about authority. One draft we read stresses that a valid signature over a record proves only that a key signed it, and verifiers must not infer authority from that alone [BI-FIND-2026-1158](https://insights.bostonidentity.com/ref/BI-FIND-2026-1158). Another tells verifiers to check the signature over the exact bytes received rather than strip unknown fields and try again [BI-FIND-2026-1115](https://insights.bostonidentity.com/ref/BI-FIND-2026-1115).

## What should a security leader ask?

1. Which of our signed or hashed JSON records rely on canonical form, and which canonicalizer library does each side use?
2. Have the agent side and the enforcement point been tested against the same RFC 8785 sample values, including the number samples in Appendix B?
3. Where do we carry amounts, large integers or timestamps as JSON numbers or parsed types that could change when re-serialized?
4. When a signature check fails, does our code abort, or does it retry after removing or reordering fields?
5. When a vendor says it signs "canonical JSON", does it mean RFC 8785, and can it show us test vectors?

## Sources

- [S1] [RFC 8785: JSON Canonicalization Scheme (JCS)](https://www.rfc-editor.org/rfc/rfc8785) (RFC Editor (Independent Submission), Informational, June 2020)

## Evidence

- [BI-FIND-2026-0956](https://insights.bostonidentity.com/ref/BI-FIND-2026-0956): Schrock's Canonical Action Identifier is meant to give permits, receipts and mandates one comparable name for the action they each digest in their own way. His example of the problem: a digest over {"action": "wire"} "commits to no amount, no currency, and no beneficiary" yet looks bound to an action. A CAID instead digests a typed action object that must carry every material field its type requires, canonicalized under a registered suite; JSON Canonicalization Scheme with SHA-256 is the required one. For agent tool calls the draft defines a tool.call.1 type with the target, the tool and the arguments, and the executor must build the object from the operation it will perform, or check every material field against the relying party's system of record. A CAID received from the presenter "MAY be compared with the recomputed value, but MUST NOT replace executor-side construction." The draft states that a CAID is neither authorization nor identity. (from "Schrock's action identifier would let permits and receipts name the same agent action, and it authorizes nothing")
- [BI-FIND-2026-0510](https://insights.bostonidentity.com/ref/BI-FIND-2026-0510): Gilda's record is one in-toto statement in a signed DSSE envelope that pairs the decision a policy engine reported with the effect an observer saw, and derives an agreement value from the two: a deny beside a write that occurred is a disagreement, and "A disagreement is the record working." Revision 02 adds whether the decision point evaluated at all, so a permit given because a needed input was unavailable is visible as failing open. The signature covers RFC 8785 canonical bytes, and members a verifier can recompute catch an edit even by the key holder. What the record does not carry is the delegation chain: one subject plus a digest of the authority document, with the credential, policy and authority all bound by digest and none of them included. (from "An agent audit record that shows when a 'deny' went through anyway")
- [BI-FIND-2026-1158](https://insights.bostonidentity.com/ref/BI-FIND-2026-1158): The draft is plain about what a valid Capsule does not prove. Its ID is a SHA-256 hash over the record's canonical JSON, kept apart from any signature, and a verified Producer Envelope proves only that the holder of the key named in kid signed that ID, not that the key is authorized for the Capsule's operator, developer or action. Those two fields are required plain strings, naming the accountable tenant and the agent's identity and version. A verifier that relies on producer identity for a policy decision MUST apply an outside authorization rule and "MUST NOT infer authority from signature validity alone". The profile is deliberately agnostic about delegation, which a separate draft by Rampalli binds in. The effect has the same limit: confirmed means the producer bound the bytes of a response it observed, not that the world reached that state, and the draft does not mitigate a forged success delivered on the path, which produces an honest confirmed Capsule for an effect that never landed. (from "A draft records every AI agent verdict, refusals too, and won't let a dispatched action pass as confirmed")
- [BI-FIND-2026-0524](https://insights.bostonidentity.com/ref/BI-FIND-2026-0524): Coetzee's answer to a hijacked agent is a token that is good for one declared call and nothing else. A root token from a person narrows through delegated tokens to a leaf that lives "on the order of seconds" and can carry a digest: SHA-256 over the canonical JSON of the tool, its parameters and the target. The enforcement point recomputes the digest over the call actually made and refuses on a mismatch or a missing claim. The draft is plain about what that buys. A compromised agent holds a token "cryptographically useless" for any other action, but nothing stops an authorized agent doing a harmful thing it declared. And the binding itself is optional: a MAY on each leaf token. (from "Coetzee's agent token is good for one declared call, and the hard part is hashing that call the same way twice")
- [BI-FIND-2026-0525](https://insights.bostonidentity.com/ref/BI-FIND-2026-0525): The author ranks his own design's risks and puts canonicalization mismatch first: if the agent side and the enforcement point serialize the same call differently, "a divergence is a full authorization bypass". Attenuation bypass, downgrade, replay and parser bugs follow. The draft leaves open the pieces that would close those gaps. It never defines the transaction-context hash the leaf carries, never says which party requests the leaf or how the enforcement point learns the declared parameters before the call, and describes replay defence only as a single-use nonce cache. A reference implementation and an adversarial review are claimed, with no name, link or result. (from "Coetzee's agent token is good for one declared call, and the hard part is hashing that call the same way twice")
- [BI-FIND-2026-1115](https://insights.bostonidentity.com/ref/BI-FIND-2026-1115): Revision -12 reversed the draft's rule on receipt fields a verifier does not recognize. Revision -11 told verifiers to ignore unknown fields in the receipt body. Now the top-level field set is closed: an issuer must not add fields, and a verifier must reject a receipt that carries one, because, in Nelson's words, "an unrecognized field could be a restriction on authority." Extensions go in a signed metadata object whose contents verifiers must ignore when deciding. Verifiers must also check the signature over the exact bytes received rather than strip unknown fields and verify again. Revision -14 removed a leftover line in the canonicalization section that said unknown fields must be dropped, which the change log calls a contradiction with the closed set; the line now only bars issuers from putting unknown fields into what they sign. The draft credits the -12 change to a proposal by Iman Schrock of the EMILIA Protocol on the IETF OAuth mailing list, a thread we have not seen. (from "Delegation receipts for AI agents, revision 15: holding a copy of a receipt no longer lets you extend the chain")

---

© 2026 Boston Identity LLC. All rights reserved. Published by Boston Identity LLC.
Quote up to 100 words with the credit "Boston Identity, IAM Insights" and a link to https://insights.bostonidentity.com/glossary/jcs as the source. Claim numbers may be cited freely. Training, fine-tuning and text-and-data-mining use of this page is permitted.
Terms: https://insights.bostonidentity.com/terms · How to cite: https://insights.bostonidentity.com/cite
