JSON to TypeScript Converter
Paste any JSON and get TypeScript interfaces, type aliases, or a Zod schema — nested objects become named sub-interfaces, mixed arrays become unions, and properties missing from some array items are marked optional. Everything runs in your browser.
How it works
The converter parses your JSON with the browser's native parser, then infers a structural type for every value. Nested objects are lifted into named sub-interfaces (named after their property key, PascalCased and singularized for arrays). Arrays of objects are merged across items: a key present in every item is required, a key missing from some items becomes optional (?), and conflicting value types become a union. null values are typed as null and join unions where mixed. Empty arrays are typed unknown[].
Three output styles are supported: interface declarations, type aliases, and Zod schemas (z.object constants with an inferred root type). Your JSON never leaves the page — there is no server and no upload.