JSON to Python
Generate Python dataclass definitions from JSON data.
Runs entirely in your browser.
Convert JSON to Python Tool
About JSON
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.
Learn more: JSON Tutorial
About Python Dataclasses
Python dataclasses (introduced in Python 3.7) generate boilerplate like __init__, __repr__, and __eq__ automatically from type-annotated class attributes. They are a clean, standard-library way to model structured data such as parsed JSON.
This tool infers types from your sample: strings become str, whole numbers int, decimals float, booleans bool, nulls Optional, arrays List, and nested objects become their own dataclass. JSON keys that are not valid Python identifiers are renamed, with the original key noted in a comment.
Learn more: Python Tutorial