JSON to TypeScript
Generate TypeScript interfaces from JSON.
How to use
- 1Paste a sample JSON response or object.
- 2Set the root name, for example User.
- 3Choose interface or type.
- 4Copy the generated TypeScript.
Frequently asked questions
How are optional fields detected?
In arrays of objects, a key missing from some items is marked optional (key?:). Use a sample with all variations for the best result.
How are nested objects named?
From their key names in PascalCase, e.g. address → Address and orders → Order (singular for array items).
What about null values?
They're typed as null. If the field can also hold other values, change it to something like string | null.
Is my JSON uploaded?
No. Everything is generated in your browser.
You may also need
HTML Entity Encoder
Escape and unescape HTML entities.
Number Base Converter
Binary, octal, decimal, hex and any base.
Cron Expression Explainer
Cron schedules in plain English with next runs.
IP Subnet Calculator
Network, mask, broadcast and host range.
Chmod Calculator
Linux file permissions as numbers and rwx.
CSS Gradient Generator
Linear, radial and conic gradients with preview.