Canonicalization
Also called: canonical encoding, JSON Canonicalization Scheme, JCS
Canonicalization gives data a precisely defined representation so independent systems can produce the same bytes. This matters when hashing or signing structured messages: whitespace or property order can change the bytes even when a reader interprets the same object. Both sides must use the same canonicalization rules.
For example, JSON objects written with b before a or with a before b can become the same canonical text under the JSON Canonicalization Scheme. JCS defines property ordering and number serialization while preserving array order; it does more than remove spaces. Its input constraints also matter, and it does not normalize Unicode strings. Canonical bytes support consistent verification but do not themselves prove who created the data.
- Read first
- Serialization
- Further reading
- IETF — RFC 8785, JSON Canonicalization Scheme