JSON to TypeScript
Paste any JSON and instantly generate a matching TypeScript interface, including nested objects and arrays.
JSON input
Generated TypeScript
About the JSON to TypeScript
This tool converts a JSON object into a matching TypeScript interface, inferring the correct type for every field including nested objects and arrays, so you don't have to type it out by hand.
How to use
1
Paste a sample JSON object into the input field.
2
Optionally set a name for the root interface.
3
Copy the generated TypeScript interfaces into your project.
Frequently asked questions
Does this generate types for nested objects too?
Yes, any nested object gets its own named interface, generated automatically based on the key it was found under.
What happens if a field could be null?
A field with a null value in your sample JSON is typed as null. If that field could also hold other values elsewhere, you may want to manually adjust the type to a union afterward.
Related tools
Explore more tools in the Developer category.