JSON to TypeScript

Paste a JSON sample, such as an API response, to generate TypeScript interfaces for it. Nested objects get their own named types.

Output

How the types are inferred

One sample is not a schema

The types describe the JSON you paste. If a field can be null or missing in other responses, paste an array with several examples so the tool can see the variation, or adjust the output by hand. For runtime validation, pair the types with a schema library such as Zod.

Frequently asked questions

How do I generate TypeScript types from an API response?
Copy the JSON response (from your browser's network tab, curl or Postman), paste it here, and copy the interfaces into your code.
Should I use interface or type?
Either works for object shapes. Interfaces can be extended and merged; type aliases can also express unions. Pick whichever your codebase uses.
Why is a field typed as null?
In your sample it was always null, so there is nothing else to infer. Change it to the real type, e.g. string | null.
Is my JSON uploaded?
No. Types are generated in your browser.