Skip to main content

JSONEncoder

Project description

JSONEncoder

A JSONEncoder that knows how to serialize Decimal, datetime, timedelta, and UUID types. It will also serialize any object that has to_dict method.

Code must be formatted with black before pushing:

black .

Basic usage

from datetime import datetime
from newstore.json_encoder import serialize, deserialize

serialized = serialize({"now": datetime.now()})  #  The result is JSON {"now": "2019-12-05T13:14:07.901135"}

How to run tests

cd json_encoder
python -m unittest

Publishing the package to PyPi

First, build the wheel

rm -rf dist
python3 setup.py sdist bdist_wheel

Then publish the package to PyPi:

python3 -m twine upload dist/*

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

newstore.json_encoder-1.0.4.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

newstore.json_encoder-1.0.4-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

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