JSON → TypeScript

Convert JSON objects into TypeScript interfaces or type aliases automatically.

Array:
JSON InputN/A
TypeScript Output

TypeScript interfaces will appear here

Free online JSON to TypeScript interface generator

Writing TypeScript interfaces by hand for large API responses is tedious and error-prone. This tool automates the process: paste any JSON object and it immediately generates correctly typed TypeScript interfaces for the entire structure, including nested objects and arrays. What would take minutes by hand takes seconds here.

Options let you tailor the output to your codebase conventions: use interface or type alias, mark all props optional, add readonly modifiers, or switch array notation. The generated interfaces are ready to paste into your TypeScript source files. All inference runs client-side so no data is shared externally.

Step-by-step guide

  1. 1
    Paste your JSON
    Copy a JSON object from an API response, config file, or data fixture and paste it into the left panel.
  2. 2
    Set the root interface name
    Enter a meaningful name in the Root name field: this becomes the name of the top-level interface or type alias.
  3. 3
    Configure the options
    Toggle Optional props to mark all properties with ?, Use type for type aliases instead of interfaces, Readonly to add the readonly modifier, or change the array notation between T[] and Array<T>.
  4. 4
    Copy the TypeScript output
    The right panel updates instantly. Click Copy to grab the generated interfaces and paste them into your TypeScript project.
  5. 5
    Review nested interfaces
    Nested objects and arrays of objects automatically generate additional named interfaces below the root type, ready to use.

Related Tools

Frequently Asked Questions

What does this tool generate from JSON?
The tool inspects each key and value in the JSON object and generates a corresponding TypeScript interface (or type alias) with the inferred types: string, number, boolean, null, nested interfaces, or arrays of each.
Does it handle nested objects?
Yes. Nested objects produce additional named interfaces. For example, if the root object has an address key containing an object, an Address interface is generated and referenced from the root.
Does it handle arrays?
Yes. Arrays of primitives are typed as string[], number[] etc. Arrays of objects create a named item interface (e.g. TagsItem[]) and reference it in the parent.
What is the difference between interface and type alias?
Both describe an object shape in TypeScript. Interfaces support declaration merging and are traditionally preferred for public API shapes. Type aliases are more flexible (they can represent unions, intersections, and primitives). Toggle "Use type" to switch output to type Root = {...}.
What does the Optional props option do?
When enabled, every property is marked with ? making it optional (e.g. name?: string). This is useful when your JSON may not always include all keys, such as when working with partial API responses.
Is my JSON uploaded to a server?
No. All parsing and type inference runs in your browser. Your JSON data never leaves your device.
Can I convert an array of objects (not a root object)?
The root value must be a JSON object. If you have an array at the root, wrap it in an object first: {"items": [...]} to generate the correct types.
What if a JSON value is null?
Null values are typed as null. If you expect a property to sometimes be a string and sometimes null, the generator will produce string | null when it sees both in array items. You may need to adjust manually for optional nullable properties.

AlteredIdea vs alternatives

vs server-side tools: Everything runs in your browser: your data never leaves your device.

vs VS Code extensions: No install needed. Works instantly in any browser.

vs paid tools: Completely free, no account required.