JSON to TypeScript Interface Generator

All tools

Paste JSON and generate TypeScript interfaces or type aliases with nested objects, arrays, null values, optional fields, readonly properties, and semicolons.

Options

What is a JSON to TypeScript generator?

A JSON to TypeScript generator turns sample JSON data into TypeScript interfaces or type aliases that describe the shape of the object.

It helps when consuming API responses, documenting payloads, creating front-end models, or quickly drafting types before refining them in a codebase.

How to use the JSON to TypeScript generator

  1. Paste a JSON object, array, or API response into the input editor.
  2. Choose a root type name and whether to generate interfaces or type aliases.
  3. Enable readonly, optional fields, or semicolons if they match your project style.
  4. Click Generate types and copy the TypeScript output.

Tips

  • Use representative JSON samples so optional fields and array item shapes are inferred more accurately.
  • Fields missing from some objects in an array can be marked optional.
  • Null values are represented as unions such as string | null.
  • Review generated types before committing them to production code.

Related tools

You may also find these tools useful.

JSON to TypeScript Generator FAQ

Does it support nested objects?
Yes. Nested objects are emitted as separate named interfaces or type aliases.
How are arrays handled?
Arrays are inferred from their items. Arrays of objects are merged into a shared item type, with missing fields handled as optional or undefined.
Can it generate type aliases instead of interfaces?
Yes. Use the declaration style control to switch between interfaces and type aliases.
Is my JSON uploaded?
No. Type generation runs in your browser.