All tools

JSON to TypeScript

Paste JSON and get TypeScript interfaces, including nested objects and arrays.

Browser onlyYour input is processed in this browser and is not sent to SpeedyTools servers.
Share:
Options
JSON Input
TypeScript Output
About JSON to TypeScript

TypeScript adds static types to JavaScript. Data from outside your code, like an API response, needs a type that describes its shape. This tool writes that type from a JSON sample, so you don't have to type it out field by field.

Because the types come from real data, the field names and types match what the API sent. Check them before use, since one sample can miss fields that are sometimes absent or null.

Features
Converts as you type
Handles nested objects and arrays
Optional properties toggle
Use type or interface
Set the root interface name
One-click copy to clipboard
Common use cases

API development

Type an API response from a sample payload

Data modeling

Start a type definition from an example record

Migration

Type existing JSON config files

Prototyping

Skip writing first-draft types by hand

Frequently asked questions

How do I convert JSON to TypeScript?

Paste your JSON into the input field and the TypeScript appears in the output. You can change the interface name and make properties optional or required.

What types are supported?

The tool detects string, number, boolean, null, arrays, and objects. For arrays, it takes the type from the first element, and an empty array becomes unknown[]. Each nested object gets its own named interface, such as Address for an address key, and the parent property refers to it by name.

Can I generate optional properties?

Yes. Turn on the 'Optional Properties' switch and every property gets a ? modifier. Use it for API responses where fields can be missing.

Should I use type or interface?

Both work for plain object shapes. Use 'interface' when you plan to extend the type. Use 'type' when you need unions or intersections. The tool outputs either.

Private by default

Conversion runs in your browser. Your JSON is never sent to a server.