JSON to TypeScript. And the validators to match.
Turn a JSON sample into TypeScript, Zod and JSON Schema in three tabs. Infer nested objects, mixed arrays and optional fields — free, no sign-up.
Loading the tool…
Sample-based inference. Review the generated contract before using it in production.
How to use
- Paste a representative JSON response, including multiple array items when available.
- Set a valid type name and choose Generate types.
- Switch between TypeScript, Zod and JSON Schema. Review the inferred contract, then copy or download it.
Frequently asked questions
Is this free, and do I need an account?
It is free, no sign-up. Processing happens in your browser. Tool inputs and results are not sent to a processing API or saved by this tool. Usage analytics record only the tool name and action.
Does this infer my complete API contract?
No. A sample only proves the values it contains. Review required fields, nullable values, enums, dates and business rules before treating the generated output as a production contract.
How are mixed arrays and missing fields handled?
All array elements contribute to the inferred item shape. Fields missing in any object sample become optional. Different value types become unions, including null.
What happens with empty arrays?
An empty array has an unknown item type: Array<unknown> in TypeScript, z.array(z.unknown()) in Zod and an unrestricted items schema. Add representative items for a more useful result.
Which Zod and JSON Schema versions are targeted?
The output uses Zod 4 primitives and JSON Schema draft 2020-12. The Zod object validator strips unknown object keys by default; JSON Schema allows extra properties unless you tighten it.
Are dates, integers and enums inferred?
Strings stay strings and numbers stay numbers. The tool avoids inferring a date format, integer restriction or enum from too little evidence. Add those constraints after reviewing the sample.
Related tools
All free toolsJSON diff
Compare two JSON values structurally. See added, removed and changed paths, ignoring object key order. Free, no sign-up, entirely in your browser.
JSON formatter
Format, minify and validate JSON in your browser. Choose two or four spaces, copy the result or download it. Free, no sign-up and no JSON uploads.
JSON ↔ CSV, YAML & XML
Convert JSON to CSV, YAML or XML and back in your browser. Move Next.js configs and Supabase samples locally with explicit format limits. Free, no sign-up.