Skip to main content

A fork of Python's built-in JSON module, but with added support for decimal.Decimal objects

Project description

A fork of Python's built-in JSON module, but with added support for decimal.Decimal objects.

Install using:

pip install json_with_decimals

Similar to the proposal given in this issue.

By default, decoded JSON will return decimal.Decimal objects for real numbers, and the encoder supports decimal.Decimal numbers.

Encoding decimals will disable the speedup from the C encoder, so you can temporarily disable decimal support with the support_decimal keyword argument:

import json_with_decimals as json
json.dumps(obj, support_decimal=False)

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

json_with_decimals-0.1.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

json_with_decimals-0.1.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file json_with_decimals-0.1.0.tar.gz.

File metadata

  • Download URL: json_with_decimals-0.1.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for json_with_decimals-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eb10896fcdbe32faeba095a9ec9fac71d03382d95431e900e7d6d2809f9d1f62
MD5 02023af71247cedd1ad463c39826aef8
BLAKE2b-256 433dfc8a459077276fe003895bc595cbb4c7911d8e05777691903e7b1b63bcbc

See more details on using hashes here.

File details

Details for the file json_with_decimals-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for json_with_decimals-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ec15f130482904fe421da658ed12590802bc3b5c695a2a5f7a85c400ed21a71
MD5 8fffb589659ddc026519005ddd345bce
BLAKE2b-256 07e50aa4c2f1374996afc3bdc1f836526cb26afc7ea8aa520ed4da3b57cfdc13

See more details on using hashes here.

Supported by

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