json-ext-encoder

Extended JSON encoder for Python data structures.
A subclass of JSONEncoder, it handles these additional types:
datetime.datetime— a string of the formYYYY-MM-DDTHH:mm:ss.sssZorYYYY-MM-DDTHH:mm:ss.sss+HH:MMas defined in ECMA-262.datetime.date— a string of the formYYYY-MM-DDas defined in ECMA-262.datetime.time— a string of the formHH:MM:ss.sssas defined in ECMA-262.datetime.timedelta- a string representing a duration as defined in ISO-8601. For example,timedelta(days=1, hours=2, seconds=3.4)is represented asP1DT02H00M03.400000S.decimal.Decimal,uuid.UUID— a string representation of the object.enum.Enum— a.valueproperty of enum member.
Installation
$ pip install json-ext-encoder
Usage
import json
from json_ext_encoder import JSONEncoder
json.dumps({...}, cls=JSONEncoder)
Contributing
To work on the json-ext-encoder codebase, you'll want to clone the project locally and install the required dependencies via poetry:
$ git clone git@github.com:Gr1N/json-ext-encoder.git
$ poetry install
To run tests and linters use command below:
$ poetry run tox
If you want to run only tests or linters you can explicitly specify which test environment you want to run, e.g.:
$ poetry run tox -e py37-tests
License
json-ext-encoder is licensed under the MIT license. See the license file for details.
Metadata
Release files for json-ext-encoder 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| json-ext-encoder-0.2.0.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| json_ext_encoder-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.2 kB
Release files / json-ext-encoder-0.2.0.tar.gz
| Download URL | json-ext-encoder-0.2.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bafb5834e513814134679c52c6b7c8f757cb055fbaa020d0e0659c64a086a013
|
|
BLAKE2b-256 checksum How to use checksums |
f3b92b5d6013063c1d7463d58c1a90de50c03fd93a2fa530bf8758ac5511c0bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / json_ext_encoder-0.2.0-py3-none-any.whl
| Download URL | json_ext_encoder-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
699a0c8efd4e1af1e6cc737f9ed06dd6acc8d5028605e5b2a016d841d9c439a5
|
|
BLAKE2b-256 checksum How to use checksums |
543d5372d4cd790a35be371c90359cea9683aacd7d4e6415fa849ae97d679381
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |