JSON → Zod

Generate a Zod schema (with inferred TypeScript type) from a JSON sample.

Runs entirely in your browser

FAQ

Does the generator distinguish int and float?
Yes. Whole numbers become z.number().int(); numbers with fractional parts become z.number().
How are optional fields represented?
This tool infers the schema from a single JSON sample, so it can't tell which keys are optional. Add .optional() manually where needed, or generate against multiple samples and merge.

Related tools