JSON de/serializers
Project description
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.
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
json-serde-0.0.9.tar.gz
(10.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file json-serde-0.0.9.tar.gz.
File metadata
- Download URL: json-serde-0.0.9.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.12.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eae7dbb303a9314f8b42d7800b185e8d4fdc5bb8966c408c50adfd43cc71c1f6
|
|
| MD5 |
eb96f3b4a55f8be6325280807e252ccf
|
|
| BLAKE2b-256 |
d5736ba7aa0db9ec1d790a27dd60c5461c906789a59ef7a3ab56e9b13f45b0df
|
File details
Details for the file json_serde-0.0.9-py3-none-any.whl.
File metadata
- Download URL: json_serde-0.0.9-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.12.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c705852200bc2d93954f78e969c72a0ef1c3193e10ed2239ad72243115412a56
|
|
| MD5 |
747df2e6560750221e8f2c40640698c1
|
|
| BLAKE2b-256 |
b6caff05f93770959ab387f9b0c1e2700d521c38daed78e9a978b556ca2a79c0
|