TypeScript interfaces

TypeScript interfaces

Turn a JSON sample into TypeScript interfaces, with nested names and optional fields.

About this tool

TypeScript interfaces describe the shape of JSON from an API. Writing them by hand is dull, and a sample response already holds the field names and types.

Paste JSON to get exported interfaces, with nested objects named and arrays typed. If the sample is an array of objects, fields missing from some rows become optional and values become unions. Copy or download a .ts file.

Worked example

The object {"name":"Ada","address":{"city":"London"}} becomes an interface Person with name: string and address: Address, plus a second interface Address with city: string.

Common searches