JSON to TypeScript
JSON to TypeScript turns a JSON sample into ready-to-use TypeScript interfaces or type aliases. Nested objects become named interfaces, arrays are merged and keys missing from some items become optional. It runs in your browser.
How to use JSON to TypeScript
- Paste a sample of your JSON.
- Choose interfaces or type aliases and set the root name.
- Copy the TypeScript.
Frequently asked questions
How do I generate TypeScript types from JSON?
Paste a sample of the JSON, choose interfaces or type aliases and copy the result.
How does it handle arrays of objects?
The items are merged into one type. Keys that are missing from some items become optional.
Is my JSON uploaded?
No. The types are generated in your browser.
Next step
Need a schema instead of types? Generate a JSON Schema. Open JSON Schema Generator.