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.

Files for newstore.json-encoder, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size newstore.json_encoder-1.0.4-py3-none-any.whl (4.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size newstore.json_encoder-1.0.4.tar.gz (2.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page