JSON to TypeScript
convert JSON objects to TypeScript interfaces automatically
By Bikram NathLast updated
Paste a raw JSON object and get TypeScript interface declarations back. Nested objects become separate named interfaces, arrays become T[], and any field holding null gets typed as T | null. Useful when a teammate hands you an undocumented API response and you need to type it before wiring it into a service layer. Unlike quicktype, there is no CLI install or schema export step needed for a one-off conversion.
Try it now — free, instant, no signup
What is JSON to TypeScript?
This converter reads a JSON value, infers the TypeScript type of each key, and emits interface declarations you can paste directly into a .ts file. Give it {"user":{"id":1,"roles":["admin","viewer"]}} and you get a Root interface with a user field typed to a User sub-interface, where id is number and roles is string[]. The nesting depth is followed automatically, so deeply nested API payloads produce a set of small, flat interface files rather than one giant inline object type.
For a simple one-off conversion, when you have a Postman response and need interfaces in under a minute, this removes the install and config overhead. quicktype (quicktype.io) is the right reach when you need class output, Zod schemas, JSON Schema, or reproducible multi-language generation inside CI. json2ts.com covers similar ground but provides fewer type-narrowing notes on ambiguous fields like null or mixed arrays.
One important gotcha: types are inferred from the single sample you paste. If a field is null in your sample but is actually a string at runtime, the generated interface will read field: null instead of field: string | null. Always use a representative sample that includes non-null values for every field you care about, or plan a manual review pass on any null-typed field in the output.