freshcrate
Skin:/
Home > Frameworks > dataclass-wizard

dataclass-wizard

A wizard-like JSON serialization library for Python dataclasses

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

.. image:: https://raw.githubusercontent.com/rnag/dataclass-wizard/main/images/logo.png :alt: Dataclass Wizard logo :width: 160px :align: center **Simple, elegant wizarding tools for Pythonโ€™s** ``dataclasses``. ๐Ÿ“˜ Docs โ†’ `dcw.ritviknag.com`_ .. image:: https://github.com/rnag/dataclass-wizard/actions/workflows/dev.yml/badge.svg :target: https://github.com/rnag/dataclass-wizard/actions/workflows/dev.yml :alt: CI Status .. image:: https://img.shields.io/pypi/v/dataclass-wizard.svg :target: https://pypi.org/project/dataclass-wizard/ :alt: PyPI Version .. image:: https://img.shields.io/pypi/pyversions/dataclass-wizard.svg :target: https://pypi.org/project/dataclass-wizard/ :alt: Supported Python Versions .. image:: https://static.pepy.tech/badge/dataclass-wizard :target: https://pepy.tech/project/dataclass-wizard :alt: Downloads per Month **Dataclass Wizard** is a fast, well-tested serialization library for Python dataclasses. ------------------- **Behold, the power of Dataclass Wizard**:: >>> from __future__ import annotations >>> from dataclasses import field >>> from dataclass_wizard import DataclassWizard ... >>> class MyClass(DataclassWizard, load_case='AUTO', dump_case='CAMEL'): ... my_str: str | None ... is_active_tuple: tuple[bool, ...] ... list_of_int: list[int] = field(default_factory=list) ... >>> MyClass.from_json( ... '{"my_str": 20, "ListOfInt": ["1", "2", 3], "isActiveTuple": [true, false, 1]}' ... ) MyClass(my_str='20', is_active_tuple=(True, False, True), list_of_int=[1, 2, 3]) .. note:: The example above demonstrates automatic type coercion, key casing transforms, and support for nested dataclasses. ``DataclassWizard`` also auto-applies ``@dataclass`` to subclasses. .. tip:: A new **v1 engine** is available as an opt-in, offering explicit environment precedence, nested dataclass support, and improved performance. ``EnvWizard`` v1 adds field-level configuration on top of these improvements. See the `Field Guide to V1 Opt-in`_ and the `hands-on quickstart`_ for details. .. contents:: Contents :depth: 1 :local: :backlinks: none Why Dataclass Wizard? --------------------- Dataclass Wizard helps you turn Python dataclasses into robust, high-performance serialization schemas with minimal effort. - ๐Ÿš€ Fast โ€” code-generated loaders and dumpers - ๐Ÿชถ Lightweight โ€” pure Python, minimal dependencies - ๐Ÿง  Typed โ€” powered by Python type hints - ๐Ÿง™ Flexible โ€” JSON, YAML, TOML, and environment variables - ๐Ÿงช Reliable โ€” battle-tested with extensive test coverage Quick Examples -------------- .. rubric:: JSON De/Serialization .. code-block:: python3 from dataclasses import dataclass from dataclass_wizard import JSONWizard @dataclass class Data(JSONWizard): value: int data = Data.from_dict({"value": "123"}) assert data.value == 123 print(data.to_json()) .. rubric:: Environment Variables .. code-block:: python3 import os from dataclass_wizard import EnvWizard os.environ['DEBUG'] = 'true' class Config(EnvWizard): debug: bool cfg = Config() assert cfg.debug is True .. rubric:: EnvWizard v1 (Opt-in) .. code-block:: python3 import os from dataclass_wizard.v1 import EnvWizard, Env os.environ['DEBUG_MODE'] = 'true' class Config(EnvWizard): debug: bool = Env('DEBUG_MODE') cfg = Config() assert cfg.debug is True .. tip:: EnvWizard v1 introduces explicit environment precedence and nested dataclass support. See `Field Guide to V1 Opt-in`_ for full details. Installation ------------ Install from `PyPI`_: .. code-block:: console pip install dataclass-wizard Or via `conda-forge`_: .. code-block:: console conda install -c conda-forge dataclass-wizard Dataclass Wizard supports **Python 3.9+**. .. note:: Python 3.6โ€“3.8 users should install the last supported release, ``dataclass-wizard==0.26.1``. See `PyPI`_ for historical versions and the `Changelog`_ for details. .. _PyPI: https://pypi.org/project/dataclass-wizard/ .. _conda-forge: https://conda-forge.org/ .. _Changelog: https://dcw.ritviknag.com/en/latest/history.html Wizard Mixins โœจ ---------------- In addition to ``JSONWizard``, Dataclass Wizard provides a set of focused Mixin_ classes to simplify common serialization tasks: - ๐Ÿช„ `EnvWizard`_ โ€” Load environment variables and ``.env`` files into typed schemas, including support for secret directories. - ๐ŸŽฉ `JSONPyWizard`_ โ€” A helper for ``JSONWizard`` that preserves keys as-is (no case transformations). - ๐Ÿ”ฎ `JSONListWizard`_ โ€” Extend ``JSONWizard`` to convert lists into container objects. - ๐Ÿ’ผ `JSONFileWizard`_ โ€” Load and save dataclass instances from local JSON files. Optional format support: - ๐ŸŒณ `TOMLWizard`_ โ€” Map dataclasses to and from TOML. - ๐Ÿง™โ€โ™‚๏ธ `YAMLWizard`_ โ€” Convert between YAML and dataclasses using ``

Release History

VersionChangesUrgencyDate
main@2026-06-01Latest activity on main branchHigh6/1/2026
0.39.1Imported from PyPI (0.39.1)Low4/21/2026
main@2026-04-01Latest activity on main branchMedium4/1/2026
main@2026-04-01Latest activity on main branchMedium4/1/2026
main@2026-04-01Latest activity on main branchMedium4/1/2026
main@2026-04-01Latest activity on main branchMedium4/1/2026
main@2026-04-01Latest activity on main branchMedium4/1/2026
main@2026-04-01Latest activity on main branchMedium4/1/2026
main@2026-04-01Latest activity on main branchMedium4/1/2026
v0.39.1Tag v0.39.1Low1/6/2026
v0.39.0Tag v0.39.0Low1/1/2026
v0.38.2Tag v0.38.2Low12/27/2025
v0.38.1Tag v0.38.1Low12/27/2025
v0.38.0Tag v0.38.0Low12/27/2025
v0.37.0Tag v0.37.0Low12/20/2025
v0.36.6Tag v0.36.6Low12/19/2025
v0.36.5Tag v0.36.5Low12/19/2025
v0.36.4Tag v0.36.4Low12/18/2025
v0.36.3Tag v0.36.3Low12/18/2025
v0.36.2Tag v0.36.2Low12/15/2025
v0.36.1Tag v0.36.1Low12/15/2025
v0.36.0Tag v0.36.0Low12/14/2025
v0.35.4Tag v0.35.4Low12/13/2025
v0.35.3Tag v0.35.3Low12/12/2025
v0.35.2Tag v0.35.2Low12/12/2025
v0.35.1Tag v0.35.1Low7/27/2025
v0.35.0Tag v0.35.0Low1/20/2025
v0.34.0Tag v0.34.0Low12/30/2024
v0.33.0Tag v0.33.0Low12/17/2024

Dependencies & License Audit

Loading dependencies...

Similar Packages

py-serializableLibrary for serializing and deserializing Python Objects to and from JSON and XML.2.1.0
jsonconversionThis python module helps converting arbitrary Python objects into JSON strings and back.1.2.1
flask-jwt-extendedExtended JWT integration with Flask4.7.4
polyfactoryMock data generation factories3.3.0
avroAvro is a serialization and RPC framework.1.12.1

More from pypi

markitdownUtility tool for converting various files to Markdown
fastapiFastAPI framework, high performance, easy to learn, fast to code, ready for production
djangoA high-level Python web framework that encourages rapid development and clean, pragmatic design.
flaskA simple framework for building complex web applications.

More in Frameworks

ctranslate2Fast inference engine for Transformer models
schemathesisProperty-based testing framework for Open API and GraphQL based apps
spec_driven_developSpec-Driven Develop is a platform-agnostic AI agent skill that automates the pre-development workflow for large-scale complex tasks. It is not a framework, not a runtime, not a package manager โ€” it is
cadwynProduction-ready community-driven modern Stripe-like API versioning in FastAPI