JSON to TypeScript
Turn a JSON sample into TypeScript interfaces or types, with nested objects named for you.
Runs in your browser. Nothing leaves this device.
How to use JSON to TypeScript
- 1Paste a JSON sample, such as an API response.
- 2Set the root name and choose interface or type.
- 3Copy the TypeScript or download it as a .ts file.
Questions
How are arrays of objects handled?
All the objects in an array are merged into one type. A key missing from some of them becomes optional.
What happens with null?
A null value becomes null, or joins the other type seen for that key, like string | null.
Is my JSON sent anywhere?
No. The types are worked out in your browser and nothing is uploaded.
Is it free?
Yes. No account, no watermark and no daily limit.
Related tools
- DeveloperBase64 EncoderEncode text or files to Base64 and decode it back, with URL-safe and data URL options.
- DeveloperDiff CheckerCompare two texts and see what was added and removed, line by line or word by word, and download a patch.
- DeveloperHash GeneratorGet the MD5, SHA-1, SHA-256, SHA-384 and SHA-512 of text or any file, and check it against a hash you were given.
- DeveloperJSON FormatterFormat, check and minify JSON, with the exact line of any error.
- DeveloperJWT DecoderRead the header and claims of a JSON Web Token, see when it expires, and check an HMAC signature.
- DeveloperRegex TesterTest JavaScript regular expressions live: every match highlighted, capture groups in a table, and a replace preview.