Generate TypeScript interfaces from a JSON sample — nested types included.
Infer TypeScript interfaces from a JSON object or array. Nested objects become their own named interfaces, arrays get typed element unions, and null values are marked optional. Paste an API response and get ready-to-use types. Runs entirely in your browser.
Upload your file using the tool above.
Adjust any settings to your preference.
Click the process button and wait for results.
Download your output using the download button.
No — and this catches people out. TypeScript types vanish at compile time, so an interface is a promise about the shape, not a check. If the API returns something different, your code proceeds on a false assumption. Pair generated types with runtime validation such as Zod for anything crossing a network boundary.
A null value becomes a nullable type, since a single sample cannot reveal whether the field is always null or merely null this time. Fields absent from your sample cannot be inferred at all. Generating from a response with fully populated data gives noticeably better results than one full of empty values.
For object shapes it rarely matters. Interfaces support declaration merging and produce slightly friendlier error messages; type aliases handle unions, intersections and mapped types that interfaces cannot express. Most teams pick one for consistency — interfaces for API models is a common convention.
Yes, JSON to TypeScript is completely free. No signup, no account, and no watermark on outputs. A Pro tier is available for 100 AI ops/day and larger file sizes.
JSON to TypeScript runs entirely in your browser. Your file is never uploaded — it is read, processed and saved locally, so it never reaches our servers or anyone else's. You can disconnect from the internet after the page loads and it still works.
What it does: Infers TypeScript interfaces from a JSON sample so you can type an API response or config without writing the interfaces by hand.
How types are inferred: Nested objects become their own named interfaces; arrays become typed (with a union of element types when they differ); null values are marked optional. Keys that aren’t valid identifiers are quoted.
Tip: Give it a representative sample with all optional fields present, since types are inferred only from the data you provide.
Privacy: Runs entirely in your browser. Your JSON is never uploaded, so it’s safe for internal API payloads and works offline.