json-serde
JSON de/serializer for Python, inspired by attrs and SQLAlchemy.
Example
import requests
from json_serde import JsonSerde, Integer, String, IsoDateTime
class User(JsonSerde):
username = String()
user_id = Integer(rename='userId')
birthday = IsoDateTime(is_optional=True, default=None)
resp = requests.get('https://example.com/api/user')
resp.raise_for_status()
api_response = resp.json()
# {'username': 'emmag', 'userId': 1312, 'somethingElse': ['irrelevant']}
user = User.from_json(api_response)
assert user.username == 'emmag'
assert isinstance(user.user_id, int)
assert user.birthday is None
License
This work is dual licensed under the MIT and Apache-2.0 licenses. See LICENSE-MIT and LICENSE-APACHE for details.
Release files for json-serde 0.0.11
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-serde-0.0.11.tar.gz | 10.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| json_serde-0.0.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 kB
Release files / json-serde-0.0.11.tar.gz
| Download URL | json-serde-0.0.11.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a1d63c4d4ff653c9e633031283151a753f33e49738a83ce51bbb2b414f3889f
|
|
BLAKE2b-256 checksum How to use checksums |
eecd9b7a210924a7c302c546d68eaae033a34c09881e5c1a88964c340abfdbfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
|
Release files / json_serde-0.0.11-py3-none-any.whl
| Download URL | json_serde-0.0.11-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e9009d8c1474f3c61cfc6e12f01d5c9bf608dcfd0617c83de6fdd663426ddb3
|
|
BLAKE2b-256 checksum How to use checksums |
67c2d6584d401242df9df4b0786ab6adaaa7cab5ebf0949e854720b880e464b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
|