Generate TypeScript interfaces or types from a JSON sample
Runs in your browser. Nothing you type is sent anywhere. Updated on 24 Oct 2026.Typing an interface by hand from a JSON response is tedious and easy to get wrong. Paste 1 sample and get TypeScript interfaces or types back, with nested objects and arrays handled. The sample stays in your browser, so a response full of real data goes nowhere.
Paste a sample JSON response into the JSON pane, or click Try an example.
Set the Root name and choose Interface or Type.
Choose how null values are typed, "| null" or Optional, and turn Export or Readonly on or off.
Click Copy, or the download icon to save a .ts file named after the root type.
This JSON to TypeScript converter reads a sample of your data and writes the matching interfaces or type aliases. Every nested object gets its own named declaration, arrays get element types, and the output updates as you type, so you can paste a response and copy working types a second later.
Developers use it when wiring up a new API: paste one response from the network tab and get the types for the fetch call. It also helps when a config file or a webhook payload has grown too large to type by hand, or when you inherit untyped JSON fixtures and want the compiler to start catching mistakes.
The generator looks at every element of an array, not just the first. Objects in an array are merged into one interface, and a key that is missing from some of them becomes optional. A field that holds different kinds of value becomes a union, such as string | number. Null values either add | null or make the property optional; you choose. Identical shapes share one declaration, and keys such as pin-code are quoted.
Everything runs in your browser and nothing you paste is sent anywhere. The types describe only the sample you give, so include an example of every variant you expect. Ctrl+Enter copies the result. Related tools: JSON Formatter, YAML to JSON, CSV to JSON.
Paste the JSON into the left pane. The interfaces appear on the right as you type. Set the root name, choose interface or type, then press Copy or Ctrl+Enter and paste the result into a .ts file.
Everything here is free, with no signup and no cap on conversions. The conversion runs entirely in your browser, so the JSON you paste never leaves your device and no copy reaches a server. API responses carrying access tokens, email addresses or order details are safe to paste.
When an array holds several objects, they are merged into one interface. A key that appears in only some of them is marked optional with a question mark. With the null option set to optional, a key whose value is null is also marked optional.
Both describe the same shape. Interfaces can be extended and merged, and many teams prefer them for objects. Type aliases can also express unions and mapped types. Pick whichever your codebase already uses; the tool writes either.
The element type becomes a union, for example (string | number)[]. An empty array becomes unknown[] because there is nothing to infer from; add one example item to get a precise type.
Yes. Files of a few megabytes convert in well under a second. Deep nesting is fine; each level gets its own named declaration, and identical shapes are reused rather than repeated.
Still stuck? Ask about JSON to TypeScript and anybody who knows can answer. No account needed.
Also works as: JSON to TS · JSON to Interface.
Same job, other tools: JSON to Kotlin for Gson – Paste JSON and get Kotlin data classes with @SerializedName for Gson · TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · JSON to YAML – Turn JSON into clean, readable YAML for configs.
On the related tools: IPv6 Subnet Calculator – IPv6 prefix range, address count as a power of two, and /64 subnets per prefix.
In the collection JSON Tools.