Convert JSON to Python Dataclasses

Paste JSON and get standard-library dataclasses — no third-party dependency needed.

AI DevRuns in your browser — nothing uploaded

Output language

How it works

  1. 1

    Reads your sample

    Every value is typed: strings, integers, floats, booleans, nulls, nested objects and arrays.

  2. 2

    Merges array items

    All objects in an array are combined into one model. A key missing from some items is marked optional.

  3. 3

    Names the classes

    Nested objects are named after their key — an “orders” array becomes an Order model. Identical shapes share one class.

  4. 4

    Handles awkward keys

    Keys like “pin-code” or “class” get a safe Python name, with a Pydantic alias so parsing still works.

Questions, answered

Pydantic v2 syntax with Python 3.10+ type hints (list[str], str | None). The models also work in Pydantic v1.10 on Python 3.10+.

Popular uses