JSON to Python Dataclass Generator

Paste a JSON sample on the left, get typed Python code on the right — dataclasses with full type hints (str, int, float, bool, List, Dict, Optional) ready for dataclasses-json or pydantic-style workflows.

100% Client-Side Instant No uploadYour data never leaves your browser

How to use this tool

Paste a representative JSON sample into the input on the left.

Python code appears on the right after the quicktype engine loads (first run only — subsequent runs are instant).

Copy the output into a .py file. The root class is named Root by default; rename it to match your domain.

Nested objects become nested dataclasses; arrays become List[T]; nullable fields become Optional[T].

Everything runs in your browser — safe to use with internal API responses.

Frequently asked questions

What Python version is the output compatible with?

The generated code uses from __future__ import annotations and modern typing syntax (List, Optional), so it runs on Python 3.7+.

How do I deserialize JSON into these dataclasses?

Pair them with dataclasses-json (@dataclass_json decorator) or pydantic TypeAdapter. The type hints map directly to both libraries.

How are unions handled?

When a field has mixed types across samples, quicktype emits Union[...] types that cover every observed variant.

Can I generate other languages?

Yes — TypeScript, Go, Java, C#, and Rust generators are also available, each with its own tool page.

Is this private?

Completely. quicktype runs in your browser; no JSON is uploaded to any server.

Related tools