JSON to Zod Schema Converter

Your json

Paste any JSON and get back Zod schema declarations (z.object(...)), inferred entirely in your browser — nothing is uploaded. Arrays of objects are structurally merged: a field present in every sample stays required, a field missing from some samples becomes .optional(), a field that is sometimes null becomes .nullable(), and a field whose value type varies becomes a z.union([...]). Repeated nested shapes (like two differently-named address objects with the same fields) are deduplicated into a single shared schema constant. Copy the output straight into a TypeScript project that has zod installed.

FAQ