Skip to content
Toolbox

JSON to TypeScript interface generator

Paste a JSON response and get the TypeScript types to go with it. Nested objects become their own interfaces, and keys that are missing in some array items become optional.

Runs in your browser. Nothing is uploaded.

Loading the JSON to TypeScript…

How to use the JSON to TypeScript

  1. Paste an example of your JSON.

  2. Choose the name of the root type and whether to write interfaces or type aliases.

  3. Copy the generated TypeScript.

Frequently asked questions

How are arrays of objects handled?

All items are merged into one type. A key that is missing in some items becomes optional, and a key with values of different types gets a union type such as string | number.

What type does null get?

null. When the same key holds a value in another item, the type becomes a union such as string | null.

  • JSON formatter New

    Format, validate and minify JSON, and explore it in a collapsible tree with a filter for keys and values. Errors are shown by line and column.

  • JSON to CSV converter New

    Turn a JSON array into a table you can sort and filter, and download it as CSV for Excel or Google Sheets. Converts CSV back to JSON too.

  • JSONPath tester New

    Query JSON with JSONPath: select fields, filter arrays on conditions and sort the results. Includes examples and a cheat sheet.

  • JSON diff New

    Compare two JSON documents and see every added, removed and changed value with its path. The order of keys does not matter. Runs locally.

All tools in Developer