skillfed

dataclasses-jsonschema

JSON schema generation from dataclasses

dataclasses-jsonschema v2.16.0 196.2K downloads/30d#9,791 on PyPI168
Permissive license MIT Abandoned released

What it is and what it does

Dataclasses-jsonschema is a lightweight library that converts Python 3.7+ dataclasses into JSON Schema definitions. It generates schemas compatible with draft-04, draft-06, Swagger 2.0, and OpenAPI 3 formats, and provides methods to serialize dataclass instances to dictionaries, deserialize dictionaries back into dataclass instances, and validate data against the generated schema.

The library is designed as a lighter-weight alternative to marshmallow and pydantic, requiring only dataclasses, jsonschema, python-dateutil, and typing-extensions as runtime dependencies. It includes optional extras for performance improvements (fastjsonschema for validation, fastuuid for UUID handling, ciso8601 for date parsing) and integrates with apispec for automatic OpenAPI/Swagger documentation generation. However, the project entered maintenance mode and is no longer actively developed, with the repository archived since August 2023.

Use it for:

  • Generate OpenAPI/Swagger documentation automatically from dataclass definitions in Flask or other web frameworks
  • Validate incoming JSON data against a schema derived from a dataclass structure before processing
  • Serialize and deserialize dataclass instances to/from JSON with built-in type checking
  • Create reusable schema definitions for APIs without writing JSON Schema by hand

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates JSON Schema from Python dataclasses and provides serialization, deserialization, and validation against the generated schema.

Yes, with conditions. The package is stable and has low install friction, but the abandoned maintenance status (last release October 2022, repository archived August 2023) means no active support for emerging Python versions or security issues. Install if your schema generation needs are straightforward and you do not require ongoing maintenance; consider pydantic or marshmallow if you need active development or broader feature coverage.

Install

dataclasses-jsonschema on PyPI

pip

pip install dataclasses-jsonschema

uv

uv add dataclasses-jsonschema

poetry

poetry add dataclasses-jsonschema

Installing dataclasses-jsonschema

Before you install

Low install friction with a pure-Python wheel. The project is in maintenance mode with only urgent bugfixes; the repository was archived after the last commit in 2023-08-19, over 1387 days ago.

License in practice

MIT license is permissive and imposes no significant restrictions on use or redistribution.

Quickstart

from dataclasses import dataclass
from dataclasses_jsonschema import JsonSchemaMixin

@dataclass
class Point(JsonSchemaMixin):
    x: float
    y: float

Point.json_schema()  # Returns schema dict
Point(x=3.5, y=10.1).to_dict()  # Serialize
Point.from_dict({'x': 3.14, 'y': 1.5})  # Deserialize

Verify before relying

  • Whether maintenance-mode status and 1387-day gap since last release poses compatibility risks with modern Python versions
  • Performance characteristics compared to actively maintained alternatives like pydantic

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 4 — python-dateutil, jsonschema, dataclasses, typing-extensions
Maintenance abandoned — 1,387 days since the last release
Last repo commit (repository archived)
First released
Downloads 196,241/month — #9,791 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: dataclasses_jsonschema-2.16.0-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries

Tags

json schema from dataclassesdataclass serialization deserializationjson validation pythonopenapi swagger schema generationdataclass to json schema
schema-generationdataclass-toolingapi-documentation

More Libraries packages