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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file newstore.json_encoder-1.0.4.tar.gz
.
File metadata
- Download URL: newstore.json_encoder-1.0.4.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42b1204405bcde6f116a24a1238960f1d4a2dd105276aeccfda958285d78c2a5 |
|
MD5 | 7953e6746f8b7a7eee0eb4d9f58da3a6 |
|
BLAKE2b-256 | b5f297b62c94f928ba540013853b107105b24861242d523f17af8128c7250d52 |
File details
Details for the file newstore.json_encoder-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: newstore.json_encoder-1.0.4-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f978dacdff3d0308466191cdcd10f2e266ab539aef5772df1b4fceed2fbaea70 |
|
MD5 | 1a13d3097523f24bc04f9ca141ffde34 |
|
BLAKE2b-256 | a9241f913a155c7b3ebf33d9d1197e0751d07aa27f5ebe0cc39ef75c2a53b50d |