JSON to TypeScript
Paste JSON and get clean, nested TypeScript interfaces with types inferred automatically.
How to use the JSON to TypeScript
- Paste a JSON object or array into the left box.
- Click “Generate interfaces”.
- Copy the TypeScript straight into your project.
About the JSON to TypeScript
This JSON to TypeScript converter reads a sample of JSON — an API response, a config file, a database record — and writes matching interface definitions with the right types inferred for each field. Nested objects become their own interfaces, arrays are typed by their first element, and primitives map to string, number or boolean. It saves you the tedious, error-prone job of hand-typing shapes for data you already have.
Strong typing is one of the biggest reasons to use TypeScript, and starting from real data means your types actually match what the server sends. The generated interfaces are exported and ready to paste into a .ts file; from there you can rename them, mark fields optional, or split them across modules as you like.
Everything runs in your browser — your JSON is never uploaded. To tidy the JSON first, use the JSON formatter or check it with the JSON validator. Need a spreadsheet instead of types? Try JSON to CSV.
Frequently asked questions
How does it decide the types?
It inspects the values in your JSON: text becomes string, numbers become number, true/false becomes boolean, and objects become their own interfaces.
What about arrays with mixed items?
The type is inferred from the first element, which covers most real API data. You can widen it to a union by hand if your array truly mixes shapes.
Are null values handled?
A null value is typed as null. You may want to change it to an optional or nullable field depending on your API.

