Skip to content
Devtoolry

JSON to TypeScript

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

About the JSON to TypeScript

The JSON to TypeScript converter generates interfaces (or type aliases) from a sample response, including nested objects and arrays, so you can type API data without writing it by hand.

Conversion happens in your browser, so your files and records stay private.

How to use the JSON to TypeScript

  1. Paste a representative JSON sample.
  2. Set the root type name and choose interface or type.
  3. Copy the generated types into your project.

Frequently asked questions

How are optional fields detected?

When an array contains objects with different keys, keys missing from some items are marked optional.

Should I trust generated types?

They describe the sample you pasted. Check them against your API documentation, especially for nullable fields.