Don's Tools · Developers · JSON to TypeScript, Pydantic & Zod

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.

JSON to Types turns a JSON sample into typed models in your browser. Paste an object or an array of objects and instantly generate TypeScript interfaces, Python Pydantic models or Zod schemas, switching between them with the tabs. Nested objects become their own named types, array items are merged so fields missing from some entries are marked optional, and null values become nullable. It is handy for typing API responses and validating structured LLM outputs, and nothing you paste is uploaded.

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.