JSON to TypeScript
Infer TypeScript interfaces and Zod schemas from one or more JSON samples.
Runs locally
Loading tool…
Loading tool…
How to use
Paste a JSON object, an array of sample objects, or newline-delimited JSON objects. Name the root type and switch between TypeScript and Zod output.
Array and JSONL samples are merged structurally: a field missing from some objects becomes optional, conflicting value types become unions, and nested objects receive stable names derived from their path. Empty arrays use unknown[] because no element type can be inferred.
FAQ
How are optional fields detected?
When merging array items or JSONL samples, a field is optional if it is absent from at least one object at the same structural level.
Does the generated Zod code run here?
No. The tool generates source code only. Copy it into a project that has Zod installed.