JSON to TypeScript Interface

Generate TypeScript interfaces from a JSON sample, including nested objects and arrays.

How do you create TypeScript types from JSON?

A JSON to TypeScript generator inspects a JSON sample and writes matching TypeScript interfaces, giving every property a type, so API responses can be used safely with autocompletion.

How to use the JSON to TypeScript Interface

    Frequently asked questions

    Interface or type alias?

    Interfaces are generated because they are easy to extend; a type alias is used only when the root JSON is not an object.

    Why is a field typed as unknown[]?

    The sample array was empty, so the item type could not be inferred.

    Is the JSON sent to a server?

    No, generation happens in your browser.