JSON to TypeScript

Paste an API response and get ready-to-use TypeScript interfaces. Keys missing from some array items are marked optional.

Input · drop a file

Output

How types are inferred

  • Each nested object becomes its own export interface, named after its key in PascalCase (tickets → Ticket).
  • All items of an array of objects are merged: a key present in only some items becomes optional (express?: boolean).
  • Mixed values become unions (string | null); empty arrays become unknown[].
  • Identical shapes reuse one interface instead of duplicating it.

Types come from one sample, so they describe what you pasted, not every response the API can send. Paste a response with as many fields filled in as possible, and widen null fields by hand.

Questions

Does it generate Zod schemas or classes?

It generates plain interfaces, which work everywhere. Runtime validation needs a library such as Zod written against your real API contract.

Are dates detected?

No. JSON has no date type, so ISO strings stay string.

Related tools