JCS (JSON Canonicalization Scheme) for Python 3 is a library that provides RFC 8785 compliant JSON canonicalization. It ensures a deterministic representation of JSON data, crucial for cryptographic operations like hashing and signing where data integrity and consistent serialization are paramount. The current version is 0.2.1, released on April 10, 2022. The project appears to have a stable, though not rapid, release cadence.
pip install jcsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `jcs.canonicalize` to obtain the canonical JSON string from a Python dictionary. The output will be a UTF-8 encoded, sorted, and consistently formatted JSON string according to RFC 8785.
Ensure that floating-point values are handled with care, or consider representing monetary or sensitive numeric data as strings if exact cross-platform canonicalization is paramount and floating-point variations are unacceptable.
Ensure all input data is composed of standard JSON-compatible Python types. Custom objects must be converted to standard types before passing them to `jcs.canonicalize`.
Be specific in searches, e.g., 'python jcs json canonicalization', and verify the source (`github.com/titusz/jcs` for this library) to avoid using an unrelated package.
For applications requiring high performance with extremely large JSON payloads, benchmark `jcs` against other serialization methods. If performance is critical, consider optimizing input data structures or exploring alternative canonicalization strategies if strictly RFC 8785 compliance can be relaxed.
No dependency data recorded yet.