Expand description
JSON Canonicalization Scheme (JCS) — RFC 8785.
Implemented inline to avoid an external dependency and to guarantee correct handling of all edge cases, especially:
- Object key sorting (RFC 8785 §3.2.1 UTF-16 code-unit order; all
ACDP keys are ASCII, where this coincides with byte/
strorder) - No whitespace
- Negative zero (
-0.0) MUST become0(the most common bug) - Non-ASCII characters emitted as-is, not
\uXXXX-escaped
Functions§
- canonicalize
- Canonicalize any serializable value to JCS bytes.
- canonicalize_
value - Canonicalize a pre-parsed
serde_json::Value. - try_
canonicalize_ value - Canonicalize a pre-parsed
serde_json::Value, returning an error if nesting exceeds the internal recursion ceiling (MAX_JCS_DEPTH). Prefer this on any path that may canonicalize untrusted / programmatically-built input.