[JSONZen]

JSON to Pydantic.

Paste sample JSON to get Pydantic v2 BaseModel classes. Runs entirely in your browser.

Pydantic

JSON → Pydantic
Idle
Loading editor…
Loading…

Frequently asked questions.

Which Pydantic version is this for?
The output works in Pydantic v2. Switch the optional syntax to `Optional[T]` if you need v1 compatibility.
How are nested objects handled?
A separate `class` is emitted per distinct object shape, named after the field that contains it. Cycles are not detected (single-sample inference).
How does it tell int apart from float?
If every observed value at a key is an integer, the type is `int`. Otherwise it falls back to `float`. Cast manually if you need stricter typing.
Does my JSON leave my browser?
No. Inference is plain TypeScript that runs locally. No network round-trip and no server.

More JSON tools.

    JSON to Pydantic — Free, Client-Side Generator | JSONZen