pyserde
Yet another serialization library on top of dataclasses
What it is and what it does
pyserde is a serialization library built on top of Python dataclasses that converts objects to and from multiple formats (JSON, YAML, TOML, MsgPack, Pickle, dict) using a decorator. You annotate your dataclass fields with PEP 484 type hints, and the library generates serialization and deserialization code automatically. It handles a wide range of types including primitives, standard containers (list, dict, set, tuple), Optional and Union types, datetime objects, UUID, Path, Decimal, Enum, and numpy types.
The library focuses on simplicity: declare your class, decorate it, and call to_json() or from_json() to convert. It supports field-level customization (rename, alias, skip conditions, custom serializers), class-level attributes (case conversion, custom serializers), and advanced features like flattening, forward references, and generic types. Dependencies are minimal and well-established (beartype for runtime type checking, jinja2 for code generation, plum-dispatch for method dispatch).
Use it for:
- Convert API request/response dataclasses to JSON for REST endpoints or webhooks.
- Load configuration files (YAML, TOML) into typed dataclass objects with validation.
- Serialize domain objects to multiple formats (JSON for APIs, Pickle for caching) from a single definition.
- Build data pipelines where objects move between services in different formats without manual conversion.
- Validate and transform incoming JSON data into strongly-typed Python objects.
- Store and retrieve structured data with automatic type checking during deserialization.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Serialize and deserialize Python dataclasses to and from JSON, YAML, TOML, MsgPack, Pickle, and dict formats using a decorator-based API.
Yes. pyserde is actively maintained, has no known vulnerabilities, supports current Python versions (3.10–3.14), and offers a clean, decorator-based API for multi-format serialization of dataclasses. Install friction is low and the dependency set is reasonable. It is a solid choice for projects that need type-safe serialization without the overhead of heavier frameworks.
Install
pyserde on PyPI
pip
pip install pyserdeuv
uv add pyserdepoetry
poetry add pyserdeInstalling pyserde
Before you install
Low friction install with a pure-Python wheel. Actively maintained with a release 4 days ago; repository shows 851 stars and recent activity. Six runtime dependencies (beartype, casefy, jinja2, plum-dispatch, typing-extensions, typing-inspect) are all standard utilities with minimal overhead.
License in practice
MIT License permits unrestricted use, modification, and distribution in both open-source and commercial projects with only attribution required.
Quickstart
pip install pyserde
from pyserde import to_json, from_json
@serde
class Foo:
i: int
s: str
obj = Foo(i=10, s='foo')
json_str = to_json(obj)
obj_restored = from_json(Foo, json_str)
Requires Python 3.10 or later (3.10, 3.11, 3.12, 3.13, 3.14 supported).
Verify before relying
- Performance characteristics compared to other serialization libraries in typical workloads.
- Maturity and stability of experimental SQLAlchemy integration.
- Whether custom (de)serializers handle all edge cases users encounter in production.
Package facts
| License | MIT License Copyright (c) 2021 yukinarit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — beartype, casefy, jinja2, plum-dispatch, typing-extensions, typing-inspect |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,290,473/month — #4,104 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyserde-0.32.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
databind.jsonDeserializes and serializes Python dataclasses…
permissive · top 15,000 on PyPI
serpyco-rsSerializes and deserializes Python dataclasses…
permissive · top 15,000 on PyPI
databindDatabind deserializes JSON-like nested data…
permissive · top 15,000 on PyPI
dataclass-wizardDataclass Wizard converts Python dataclasses to…
permissive · top 5,000 on PyPI
dataclasses-jsonConverts Python dataclasses to and from JSON…
permissive · top 1,000 on PyPI
databind.coreDeserializes and serializes Python dataclasses…
permissive · top 15,000 on PyPI
typed-json-dataclassAdds JSON serialization and type validation to…
permissive · top 15,000 on PyPI
dataclasses-json-speakeasyConverts Python dataclasses to and from JSON…
permissive · top 5,000 on PyPI
dataclasses-jsonschemaGenerates JSON Schema from Python dataclasses…
permissive · top 15,000 on PyPI
vdfSerializes and deserializes Valve's KeyValue…
permissive · top 15,000 on PyPI