Skip to content

chris-ashford/json_with_decimals

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

122,080 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

A fork of Python's built-in json module that supports decimal.Decimal objects

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • Python 100.0%