JSON to TypeScript, Pydantic & Zod
Paste a JSON sample and get TypeScript interfaces, Pydantic models or Zod schemas, with nesting, arrays and optional fields handled, all in your browser.
Files are processed in your browser and never uploaded.
How to use JSON to TypeScript, Pydantic & Zod
Add your text
Type or paste your text into the input box. Everything is handled by your own browser, so nothing is sent to a server.
Set the options
Choose Root type name. The options are visible from the start, not hidden until you paste something.
Run it and keep a copy
Press TypeScript to produce the result. Copy puts the result on your clipboard.
What this tool does
TypeScript, Pydantic and Zod from one sample
One JSON sample gives you TypeScript interfaces, Pydantic models or Zod schemas, and the tabs switch between them without re-pasting.
Nested objects become their own named types
A nested object becomes its own named type rather than an inline blob, so the result is readable and reusable.
Merges array items and marks optional fields
Array items are merged so the type covers every element, and a field missing from some of them is marked optional.
Detects nullable values
A field that is null in the sample is typed as nullable rather than being guessed at or dropped.
Runs in your browser, nothing uploaded
The sample is parsed in your browser, which matters when the easiest sample to hand is a real API response.
Frequently asked questions
Is my JSON uploaded anywhere?
No. The JSON is parsed and the types are generated entirely in your browser. Nothing you paste is sent anywhere or stored.
What can it generate?
TypeScript interfaces, Python Pydantic models and Zod schemas, from a single JSON sample. Switch between them with the tabs and copy the result.
How does it handle nested objects and arrays?
Nested objects become their own named types, and arrays use the element type. If an array holds several objects, their fields are merged and any field missing from some of them is marked optional.
Why is a field marked optional or nullable?
A field is optional when it appears in only some objects of an array, and nullable when a value was null. This keeps the generated types honest about what your data actually contains.
Is this useful for structured LLM outputs?
Yes. Paste an example of the JSON you expect a model to return and you instantly get a Pydantic model or Zod schema to validate it against, or a TypeScript interface for your code.
Last updated: