Skip to content
HQ8T

JSON to TypeScript

Generate TypeScript interfaces from JSON.

Output

How to use

  1. 1Paste a sample JSON response or object.
  2. 2Set the root name, for example User.
  3. 3Choose interface or type.
  4. 4Copy the generated TypeScript.

Frequently asked questions

How are optional fields detected?

In arrays of objects, a key missing from some items is marked optional (key?:). Use a sample with all variations for the best result.

How are nested objects named?

From their key names in PascalCase, e.g. address → Address and orders → Order (singular for array items).

What about null values?

They're typed as null. If the field can also hold other values, change it to something like string | null.

Is my JSON uploaded?

No. Everything is generated in your browser.