How to use the JSON to TypeScript tool
- Paste a JSON sample, such as an API response.
- Set the root name and choose interface or type.
- Copy the generated TypeScript into your code.
How the types are worked out
- Numbers, strings and booleans map directly to
number,stringandboolean. - Nested objects get their own interface, named after the key.
- Arrays of objects are merged into one interface, and fields missing from some items are marked optional with
?. - Mixed arrays become union types such as
(string | number)[]. - null stays
null, because the sample doesn’t show the real type. Replace it with something likestring | null.
The more complete your sample, the more accurate the types. If the JSON won’t parse, find the error with the JSON Formatter & Validator.
Frequently asked questions
How are optional fields detected?
In an array of objects, a field that appears in some items but not others is marked optional with a question mark.
Why is a field typed as null?
The sample only had null for that field, so its real type can’t be known. Paste a sample where it has a value, or edit the type by hand.
Are my files uploaded to a server?
No. HushConverts converts everything with code that runs in your browser, so your text and files stay on your device. You can even use most tools offline once the page has loaded.
More encoding & developer
- Base64 EncodeTEXT → BASE64Turn any text into Base64.
- Base64 DecodeBASE64 → TEXTPaste a Base64 string to turn it back into normal text.
- Base64 to ImageBASE64 → IMAGEPaste a Base64 string or a full data:image URI to preview the image and download it as a file.
- Image to Base64IMAGE → BASE64Drop an image to get its Base64 in the format you need: a data URI, raw Base64, a CSS background rule or an HTML img tag.
- URL Encode / DecodeTEXT → URLMake text safe to put in a URL, or turn a percent-encoded string like %E2%9C%93 back into readable text.
- HTML Entity Encode / DecodeTEXT → HTMLEscape text so it displays literally in HTML, or decode entities such as &, < and © back into the characters they stand for.
- JSON Formatter & ValidatorJSON → JSONPaste JSON to pretty-print it, minify it, or find out exactly where it’s broken.
- JSON to CSVJSON → CSVTurn a JSON array of objects into a spreadsheet-ready CSV.