JSON to TypeScript Interface
Convert JSON into TypeScript interfaces or type aliases instantly. Handles nested objects, arrays, unions, and optional keys. Free, runs in your browser.
Output
TypeScript
Frequently asked questions
How are optional fields detected?
When an array contains objects, keys missing from some items are marked optional with ?.
What happens with null values?
By default null becomes part of a union type. Turn on 'Treat null as optional' to mark those keys optional instead.
Interface or type?
Both work for object shapes. Interfaces can be extended and merged; type aliases can express unions.