Skip to content

canonicalStringify

function canonicalStringify(value): string;

Defined in: src/internal/json.ts:63

Strict canonical serialisation (keys sorted at every depth, no whitespace) for byte formats that must not silently change values — e.g. integrity hashes and idempotency comparison. Unlike canonicalJson it throws on non-finite numbers instead of writing null. Matches RFC 8785 (JCS) for strings and integers. A top-level undefined serialises as null.

Parameter Type
value CanonicalInput

string