Skip to main content

Yet another serialization library on top of dataclasses

Project description

pyserde

Yet another serialization library on top of dataclasses, inspired by serde-rs.

image image Tests codecov

Guide | API Docs | Examples

Overview

Declare a class with pyserde's @serde decorator.

@serde
@dataclass
class Foo:
    i: int
    s: str
    f: float
    b: bool

You can serialize Foo object into JSON.

>>> to_json(Foo(i=10, s='foo', f=100.0, b=True))
'{"i":10,"s":"foo","f":100.0,"b":true}'

You can deserialize JSON into Foo object.

>>> from_json(Foo, '{"i": 10, "s": "foo", "f": 100.0, "b": true}')
Foo(i=10, s='foo', f=100.0, b=True)

Features

LICENSE

This project is licensed under the MIT license.

Project details


Release history Release notifications | RSS feed

This version

0.9.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyserde-0.9.2.tar.gz (31.8 kB view hashes)

Uploaded Source

Built Distribution

pyserde-0.9.2-py3-none-any.whl (34.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page