Free · Private · In-Browser

JSON To TypeScript Interface

Infer a TypeScript interface from a representative JSON object.

Output
 

Infer a TypeScript interface

Typing an API response by hand means transcribing every field and nested shape into a TypeScript interface. This tool infers that interface from a representative JSON object, so you get accurate types to paste into your code in seconds.

It reads the structure and value types of your sample and generates matching interface definitions, including nested objects. Paste a JSON object, copy the interface, and refine any types the sample could not fully capture.

Inferred types, locally

It reads a sample response and builds a matching interface, nested shapes included, so you do not transcribe fields by hand. Inference runs in your browser and never uploads anything.

Frequently asked questions

How are TypeScript types chosen?

From your sample values: strings, numbers, and booleans map directly, arrays use the type of their first item, and nested objects become inline object types.

What happens to null values?

They are typed as null. If a field can hold a value too, change the type to something like string | null.

Should I use a real API response as the sample?

Yes, a representative one, since fields missing from the sample will be missing from the interface.

Take it further
Developer Tools

Practical utilities for everyday web development work.

Learn more