Free browser-based converter
JSON to Python Dataclass Generator
Convert JSON into Python dataclasses when you want readable, typed models for API responses, fixtures, or ETL jobs. Typify infers nested classes, list annotations, and optional fields from a sample payload automatically.
That makes it practical for backend prototyping, notebook work, and data pipelines where hand-authoring model classes would be repetitive and error-prone.
JSON input
137 / 50 KB
Python dataclasses
from dataclasses import dataclass
from typing import List, Optional
@dataclass
class Owner:
name: str
email: Optional[object] = None
@dataclass
class Job:
id: int
status: str
priority: int
owner: Owner
@dataclass
class Root:
job: JobExample
Start with the sample below, then replace it with your own data to generate output instantly.
Input JSON
{
"job": {
"id": 88,
"status": "queued",
"priority": 2,
"owner": {
"name": "Lin",
"email": null
}
}
}Python output
from dataclasses import dataclass
from typing import Optional
@dataclass
class Owner:
name: str
email: Optional[str] = None
@dataclass
class Job:
id: int
status: str
priority: int
owner: Owner
@dataclass
class Root:
job: Job