Skip to main content

canonical_json_string

Function canonical_json_string 

Source
pub fn canonical_json_string(value: &str) -> String
Expand description

Canonical JSON encoding of ONE string value (SPEC §6.1), quotes included: minimal RFC 8259 escaping, lowercase \uXXXX, no Unicode normalization — the exact same routine the protocol hashes run through. Exposed so higher layers (e.g. an ecosystem convention that canonicalises the non-hashed labels/refs fields) can produce byte-identical encodings without re-implementing the escaping rules.