yukinarit
pyserde
Python

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

Last updated Jul 5, 2026
851
Stars
60
Forks
31
Issues
0
Stars/day
Attention Score
65
Language breakdown
Python 99.9%
Dockerfile 0.1%
β–Έ Files click to expand
README

pyserde

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

pypi pypi GithubActions CodeCov

GuideπŸ‡¬πŸ‡§ | γ‚¬γ‚€γƒ‰πŸ‡―πŸ‡΅ | API Reference | Examples

Overview

pyserde is a simple yet powerful serialization library on top of dataclasses. It allows you to convert Python objects to and from JSON, YAML, and other formats easily and efficiently.

Declare your class with @serde decorator and annotate fields using PEP484 as below.

@serde
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)

That's it! If you're interested in pyserde, please check our documentation! Happy coding with pyserde! πŸš€

Features

  • Supported data formats
- dict - tuple - JSON - Yaml - Toml - MsgPack - Pickle
  • Supported types
- Primitives (int, float, str, bool) - Containers - list, collections.abc.Sequence, collections.abc.MutableSequence, tuple - set, collections.abc.Set, collections.abc.MutableSet - dict, collections.abc.Mapping, collections.abc.MutableMapping - frozenset, defaultdict, deque, Counter - typing.Optional - typing.Union - User defined class with @dataclass - typing.NewType for primitive types - typing.Any - typing.Literal - typing.Generic - typing.ClassVar - dataclasses.InitVar - Enum and IntEnum - Standard library - pathlib.Path - decimal.Decimal - uuid.UUID - datetime.date, datetime.time, datetime.datetime - ipaddress - PyPI library - numpy types - SQLAlchemy Declarative Dataclass Mapping (experimental)

Extensions

Contributors ✨

Thanks goes to these wonderful people:

Made with contrib.rocks.

LICENSE

This project is licensed under the MIT license.

Β© 2026 GitRepoTrend Β· yukinarit/pyserde Β· Updated daily from GitHub