AZ Tools

JSON to Python Dataclass Converter

Developer

Paste any JSON object or array and get ready-to-use Python `@dataclass` definitions with type hints (str, int, float, bool, List[...]) and separate classes for nested objects. Everything runs locally in your browser — your JSON is never uploaded.

Python dataclasses

How to use

  1. Paste or type your JSON into the input box.
  2. Optionally rename the root class (defaults to AutoGenerated).
  3. Copy the generated dataclasses from the output box.

Frequently asked questions

How are numbers typed?
Whole numbers become int and numbers with a decimal point become float. Adjust manually if you need a different type.
What happens with null or empty arrays?
null values map to Any and empty arrays to List[Any], since their type can't be inferred from the sample.
How are nested objects handled?
Each nested object becomes its own @dataclass, defined before the class that references it.
Is my JSON sent anywhere?
No. Conversion happens entirely in your browser; nothing is uploaded.

Related tools