Skip to main content

Python JSON writer with float formatting

Project description

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.

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

fjson-0.1.6.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

fjson-0.1.6-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file fjson-0.1.6.tar.gz.

File metadata

  • Download URL: fjson-0.1.6.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0+

File hashes

Hashes for fjson-0.1.6.tar.gz
Algorithm Hash digest
SHA256 0ea0a6df68104239b57acf542bfebd9bf23e009af7f6d34861ace36742d6b383
MD5 1e340a36461f337eb7c06faa6deafe4d
BLAKE2b-256 31b489fb81641de93ea0c0b7eafb680f666e8a5bb74902efa18598e1dd834d5f

See more details on using hashes here.

File details

Details for the file fjson-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: fjson-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0+

File hashes

Hashes for fjson-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5b968a9734aa587c3fb8cbd05809e9c22b34d95a67dde8124913e61ceb629b5b
MD5 795bba3f0f1c9a5e757924f2d0a269a3
BLAKE2b-256 6b63b2ee807afb39ec8af6cfbc49db85d75150aae7bc66217c8fd7af5a436f55

See more details on using hashes here.

Supported by

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