JSON to TypeScript Types Online
Convert JSON into TypeScript interfaces, type aliases or a Zod schema live, with real optional-field detection across arrays.
Processed entirely in your browser — nothing you enter here is ever uploaded.
Result
About this tool
This page opens the converter with type alias preselected as the output format — paste a JSON object or array and it prints type Name = { ... }; blocks instead of interfaces, useful when your codebase's style guide favors type over interface.
The inference underneath is identical to the interface mode: nested objects become their own named type, arrays of objects are compared item by item so a field missing from some entries is marked optional, and a field that mixes null with a real value comes out as a union like count: number | null.
Switch to interface syntax or a Zod schema from the same pasted JSON at any time — only the printed syntax changes, the detected shape stays the same.
Example. The object {"id":1} in interface mode emits an interface named Root whose field id has type number.
Limit. A field is optional only when it is missing from some objects inside the same array; a single object marks every present key as required.