dataclasses-jsonschema
JSON schema generation from dataclasses
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-jsonschemauv
uv add dataclasses-jsonschemapoetry
poetry add dataclasses-jsonschemaInstalling 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
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
apischemaApischema handles JSON…
permissive · top 15,000 on PyPI
hologramGenerates Draft 7 compatible JSON Schemas…
permissive · top 5,000 on PyPI
fastjsonschemaValidates JSON data against JSON Schema…
permissive · top 1,000 on PyPI
dataclasses-avroschemaGenerates Avro schemas from Python dataclasses,…
permissive · top 5,000 on PyPI
typed-json-dataclassAdds JSON serialization and type validation to…
permissive · top 15,000 on PyPI
py-avro-schemaGenerates Apache Avro schemas from Python…
permissive · top 15,000 on PyPI
desertDesert generates marshmallow serialization…
permissive · top 15,000 on PyPI
datamodel-code-generatorGenerates Python data models (Pydantic,…
permissive · top 5,000 on PyPI
dataclassesProvides the PEP 557 dataclasses module for…
permissive · top 5,000 on PyPI
jsoncompatChecks whether evolving JSON Schemas remain…
unclear · top 15,000 on PyPI