Define, serialize, deserialize, and validate Python data structures.
Project description
Serde is a lightweight, general-purpose, powerful ORM framework for defining, serializing, deserializing, and validating data structures in Python.
Getting started
Install this package with
pip install serde
Example usage
Define your data structures in a clean and obvious way.
>>> from serde import Model, fields
>>> class Dog(Model):
... name = fields.Str()
... hates_cats = fields.Optional(fields.Bool, default=True)
>>> class Owner(Model):
... name = fields.Str()
... birthday = fields.Date()
... dog = fields.Nested(Dog)
Easily serialize and deserialize arbitrary data to and from Python objects.
>>> owner = Owner.from_json('''{
... "name": "Paris Hilton",
... "birthday": "1981-02-17",
... "dog": {"name": "Tinkerbell"}
... }''')
>>> owner.name
'Paris Hilton'
>>> owner.birthday
datetime.date(1981, 2, 17)
>>> owner.dog
Dog(name='Tinkerbell', hates_cats=True)
View the latest usage and API documentation here.
License
This project is licensed under the MIT License.
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
serde-0.6.1.tar.gz
(22.9 kB
view hashes)
Built Distribution
serde-0.6.1-py2.py3-none-any.whl
(24.1 kB
view hashes)
Close
Hashes for serde-0.6.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ead230d7f5258edd46dffe4a68afb3bd619c17f02a91520c38cfac9474df2db5 |
|
MD5 | 93d82fbc745adea6b2160ed3d2a7d8dd |
|
BLAKE2b-256 | a79b2b3f264736b34782152b47379c1e8032be9db56319eecaf9182489a598b2 |