Skip to main content

Canonical JSON

Project description

Latest Version https://img.shields.io/travis/matrix-org/python-canonicaljson.svg

Features

  • Encodes objects and arrays as RFC 7159 JSON.

  • Sorts object keys so that you get the same result each time.

  • Has no insignificant whitespace to make the output as small as possible.

  • Escapes only the characters that must be escaped, U+0000 to U+0019 / U+0022 / U+0056, to keep the output as small as possible.

  • Uses the shortest escape sequence for each escaped character.

  • Encodes the JSON as UTF-8.

  • Can encode frozendict immutable dictionaries.

Installing

pip install canonicaljson

Using

import canonicaljson
assert canonicaljson.encode_canonical_json({}) == b'{}'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canonicaljson-1.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

canonicaljson-1.1.1-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file canonicaljson-1.1.1.tar.gz.

File metadata

File hashes

Hashes for canonicaljson-1.1.1.tar.gz
Algorithm Hash digest
SHA256 bb2b91c802eb61ec24e1ec409e74419fb64135317d77766f29781c11064731a1
MD5 601becfc5d83786090d32a46345f17a7
BLAKE2b-256 d46da608bcc25c0885eddcfa46ed989974347a55c082219b01c3f75c7353b40e

See more details on using hashes here.

File details

Details for the file canonicaljson-1.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for canonicaljson-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e6c12c52959a581295c0a9bad1fee9c3ddaa3706ec7d9a410f3301ef0deb4d54
MD5 ce4a1354fc8f599bf135086f87c3a07c
BLAKE2b-256 cd70ce0af51670057ae87146def13985c0f02ffc6ddb22a7340e4b31f1e0760e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page