JSON → TypeScript
Turns a JSON sample into TypeScript interfaces or type aliases. Nested objects get names of their own, keys missing in part of an array become optional, values that are sometimes null become "| null".
- In
- JSON
- Out
- TS
Waiting for input
Runs in this tab. The text is not sent anywhere.
Related
Questions
Interface or type?
Either: choose under “Declare as”. They describe the same shape; interfaces can be extended and merged, type aliases can be combined with unions.
How are nested objects named?
After their key, in PascalCase and singular for array items: "orders" becomes Order. The top level is called Root unless you rename it.
Is my JSON sent anywhere?
No. The types are generated in this tab.