Skip to content
TabKiwiTabKiwi

JSON to TypeScript

Paste a JSON response and get matching TypeScript interfaces or type aliases, nested types included.

DeveloperRuns in your browser. Your files never leave this device.
Loading tool…

About this tool

Drop in a sample API response and the tool infers a TypeScript declaration for every nested object, naming each one after its key. When an array holds several objects, their shapes are merged: a property missing from some items becomes optional and differing value types become a union. Everything is generated locally, so private payloads never leave your browser.

How to use JSON to TypeScript

  1. Paste a JSON sample into the left box.
  2. Set the root type name and choose interface or type.
  3. Toggle export, readonly or optional fields to suit your codebase.
  4. Copy the TypeScript or download it as a .ts file.

Frequently asked questions

How are optional properties detected?

If an array contains several objects and a key appears in only some of them, that key is marked with a question mark. Give the tool several representative items for the best result.

What happens with null values?

A null value is typed as null, or joined into a union such as string | null. Turn on “Null means optional” if your API omits and nulls fields interchangeably.

Why do some types say unknown?

An empty array gives no hint about its contents, so it is typed as unknown[]. Add an example item to get a precise type.

More Developer tools

View all 91 →