JSON to TypeScript

Generate TypeScript interface definitions from JSON.

Paste a JSON sample (typically an API response) and get a fully-typed TypeScript interface tree — one interface per nested object, arrays inferred from their elements. Drop the output straight into your codebase and your fetched data is type-safe.

Common use cases: writing types for a third-party API you're consuming, scaffolding domain models from sample data, generating shapes for OpenAPI responses, and getting a quick starting point before refining types by hand for optionality and unions.

JSON

TypeScript

Frequently asked questions

How are nested objects typed?
Each nested object becomes its own named interface, with a name derived from the property key. Arrays of objects become Array<T> with T as the interface for the array's element type.
What if my JSON has fields that are sometimes null or missing?
A single sample can't tell you that — the tool assumes every key in the sample is required. If you know some fields are optional, mark them with ? manually, or paste multiple sample objects so the inferer can union the differences.
How are numbers typed — int vs float?
TypeScript only has one numeric type (number) so the distinction disappears. If you need bigint for very large IDs, mark the field manually.
Can I generate Zod schemas instead of interfaces?
Not directly here — this outputs plain TypeScript interfaces. For runtime validation, take the inferred interfaces and pair them with a hand-written Zod schema, or use a dedicated tool like quicktype that emits both.