JSON to TypeScript Converter
Generate a TypeScript interface or type from a JSON sample, detecting keys that may be missing in arrays.
Runs in your browser. Nothing is sent anywhere.
When to use it
Great for frontend developers wiring up a new API: paste a sample response and get interfaces to type your fetch calls instead of writing every field by hand.
Types come only from the sample you paste: a null field becomes null and an empty array becomes unknown[]. Use the fullest sample you have, with several array items, so optional fields are detected.
How to use
- Paste a sample JSON response from your API.
- Name the root type and choose interface or type.
- Copy the code into your project.
Frequently asked questions
Is the data I paste sent to a server?
No. The tool runs in JavaScript right in your browser, and Takikit has no server that receives data. You can turn off your internet after opening the page and the tool will still work.
Is the generated type perfectly accurate?
The type is inferred from the sample data. Fields that are null or empty arrays do not give enough information, so you need to adjust them yourself.