About JSON to TypeScript
This tool converts a JSON object into TypeScript interface definitions. Paste any JSON and it infers the types of each field, creates separate interfaces for nested objects, and types arrays from their first element — giving you clean, ready-to-use TypeScript you can paste straight into your code. It runs in your browser.
How JSON to TypeScript works
How to convert JSON to TypeScript
- Paste a JSON object into the input.
- Set a root interface name and choose whether fields are optional.
- Copy the generated interfaces into your project.
How types are inferred
Strings, numbers and booleans map to their TypeScript types; null becomes any; nested objects become their own named interfaces; and arrays are typed from their first element (for example string[]).
Tips
Provide representative JSON so the inferred types are accurate. For fields that can be null or missing, enable the optional (?) option.
Common uses
- Generate TypeScript types from an API response
- Create interfaces for JSON data
- Speed up typing front-end code
- Turn a sample payload into types
- Avoid writing interfaces by hand
- Type configuration or fixture files
- Bootstrap models from JSON
- Improve type safety quickly
Frequently asked questions
How do I convert JSON to a TypeScript interface?
Paste the JSON and the tool infers and generates the interfaces for you to copy.
Does it handle nested objects?
Yes — each nested object becomes its own named interface.
How are arrays typed?
From the first element, e.g. an array of strings becomes string[].
Can fields be optional?
Yes — enable the optional option to add ? to each field.
What happens with null values?
They are typed as any, since the real type cannot be inferred.
Is my data uploaded?
No — conversion runs entirely in your browser.
Does it support arrays at the root?
Yes — it types the first element of a root array.
Is it free?
Yes — completely free with no sign-up.