JSON to TypeScript
Turn a JSON sample into TypeScript interfaces, nested types included.
Input
Waiting for input
Output
or press ⌘/Ctrl + EnterYour result appears here.
- Runs in your browser
- Nothing is uploaded
- Free, no sign-up
How to use it
- Paste a JSON object or array, for example an API response.
- Name the root type and choose interface or type alias style.
- Copy the generated types into your project.
Why Tool Dock
- FastEverything runs on your own device, so there is no queue and no waiting for uploads.
- PrivateYour files and text never leave the browser. Close the tab and they are gone.
- Batch friendlyDrop several files at once and download each result, or all of them together.
Questions
How are arrays of objects handled?
Every element is merged into one type. A field present in some elements but not others becomes optional, and different value types become a union.
Where do the type names come from?
From the property names, converted to PascalCase and singularised for arrays, so “users: [...]” becomes User[]. Clashes get a number suffix.
Why are some fields typed as null or unknown?
A null in the sample is typed as null (combine it with the real type yourself), and an empty array has no elements to learn from, so it becomes unknown[].
Related tools
- CSV to JSONTurn CSV or TSV data into JSON objects, with the delimiter detected for you.
- JSON to CSVTurn a JSON array into a CSV you can open in Excel or Google Sheets.
- YAML to JSON ConverterConvert YAML to JSON and JSON to YAML, with the exact line of any error.
- Base64 DecodeTurn Base64 back into text, images or files, right in your browser.
- Base64 EncodeTurn text or any file into Base64, right in your browser.
- BIMI CheckerCheck whether your brand logo can show next to your emails: BIMI record, logo, certificate and DMARC.