JSON to Python Classes
Paste JSON and get Python dataclasses, TypedDicts or Pydantic models. More data tools
Generate Python classes from JSON
Pick the style you use: dataclass, TypedDict or Pydantic BaseModel. Field names are converted to snake_case, reserved words get a trailing underscore, optional keys default to None and are placed after required fields so the class is valid.
Features
- Live: the result updates while you type.
- Clear errors: the line, the reason and, where possible, a one-click fix.
- Open and drop files, copy or download the result, and share your input as a link.
- Send to another tool: pass the result straight to a related tool.
- Private: Everything runs in your browser. Your data is not uploaded to any server.
Related data tools
- JSON to TypeScript: Paste JSON and get TypeScript interfaces.
- JSON to Go: Paste JSON and get Go structs with json tags.
- JSON to Java: Paste JSON and get Java records or classes.
- JSON to C#: Paste JSON and get C# classes or records.
- All DataMint tools
Frequently asked questions
Which style should I pick?
Dataclass for plain objects, Pydantic when you also want validation, TypedDict for typed dictionaries.
How are keys like "user-name" handled?
They become user_name. Keep the original JSON keys in mind if you load data directly.
Is my data private?
Everything runs in your browser. Your data is not uploaded to any server. You can even use the tool offline once the page has loaded.