Skip to content
forked from nschloe/fjson

Python JSON writer with formatted floats

License

Notifications You must be signed in to change notification settings

DuncanMcGeehan/fjson

 
 

Repository files navigation

fjson

JSON with float formatting.

PyPi Version PyPI pyversions GitHub stars Downloads

gh-actions codecov Code style: black

The json module in the Python standard library does not allow you to specify the format in which floats are written out the file. This module adds the float_format parameter.

import math
import fjson


data = {"a": 1, "b": math.pi}
string = fjson.dumps(data, float_format=".6e", indent=2, separators=(", ", ": "))
print(string)
{
  "a": 1,
  "b": 3.141593e+00
}

License

fjson is published under the MIT license.

About

Python JSON writer with formatted floats

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%