JSON to Pydantic, TypeScript & Dataclass Converter

Paste a JSON response and get typed models you can drop into your code. Nested objects become their own classes, and fields missing from some array items become optional.

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