About the JSON to TypeScript
Typing an API response by hand is slow and error-prone. Paste a JSON sample and this tool writes TypeScript interfaces for it: nested objects become their own named interfaces, arrays get element types, and mixed arrays become union types.
Keys that are not valid identifiers are quoted, and you choose the name of the root type.
How to use the JSON to TypeScript
- Paste a JSON sample (an object or an array).
- Set the root type name.
- Copy the generated interfaces.
Features
- Named nested interfaces
- Array and union types
- Quotes unusual keys
- Clear errors for invalid JSON
Supported formats
- Plain text
Frequently asked questions
Can it tell which fields are optional?
In arrays of objects, a key missing from some items is marked optional (?). From a single object it cannot know, so review the result.
Is my text sent anywhere?
No. Everything runs in your browser, so nothing you paste is uploaded or stored.