Rules
Sort keys lexicographically; minimal escaping in strings; numbers in shortest form; no insignificant whitespace.
Why it matters
Standard JSON allows arbitrary key ordering, whitespace, number formatting. Two parsers can serialise the same logical content to different bytes — a signature over one serialisation won't verify over the other. JCS makes signatures reproducible.
Use in work receipts
Receipts are JCS-canonicalised before Ed25519 signing. The verifier re-canonicalises the receipt content (minus signature) and verifies against the signature.
Implementations
TypeScript: canonicalize npm package. Python: jcs PyPI package. Spec repo includes test vectors.