rfc8785.py is a pure-Python, no-dependency implementation of RFC 8785, also known as the JSON Canonicalization Scheme (JCS). It provides deterministic serialization of JSON data, essential for cryptographic operations like hashing and signing where byte-identical representations are required for logically equivalent data. The library is actively maintained, with version 0.1.4 being the latest stable release, and it follows an irregular release cadence driven by contributions and fixes.
pip install rfc8785Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to use `rfc8785.dumps` to get the canonical byte representation of a Python dictionary. The output is always UTF-8 encoded bytes with keys sorted lexicographically, and specific number and literal serialization as per RFC 8785.
Ensure all dictionary keys in the input data are strings before passing to `rfc8785.dumps` or `rfc8785.dump`.
Call `.decode('utf-8')` on the result of `rfc8785.dumps` if a string is needed (e.g., `rfc8785.dumps(data).decode('utf-8')`).Ensure numbers adhere to IEEE 754 double-precision standards. Large integers or special float values (NaN, Inf) must be serialized as strings in the input data if they are not representable.
Do not expect or attempt to configure `rfc8785` for human-readable output; its purpose is machine-readable canonicalization.
No dependency data recorded yet.