JSON to TypeScript

Paste JSON and get TypeScript interfaces. More data tools

Generate TypeScript interfaces from JSON

The generator reads the whole sample, not just the first item. Keys missing from some array items become optional (?), values that are sometimes null become | null, and nested objects get their own named interface.

Choose interface or type, add export or readonly, and set the root name.

Features

  • Live: the result updates while you type.
  • Clear errors: the line, the reason and, where possible, a one-click fix.
  • Open and drop files, copy or download the result, and share your input as a link.
  • Send to another tool: pass the result straight to a related tool.
  • Private: Everything runs in your browser. Your data is not uploaded to any server.

Related data tools

Frequently asked questions

Does it handle arrays of different objects?

Yes. The items are merged into one type and keys that are not in every item are optional.

Are number types exact?

TypeScript has one number type, so integers and decimals are both number.

Is my data private?

Everything runs in your browser. Your data is not uploaded to any server. You can even use the tool offline once the page has loaded.