Paste a JSON sample and get Zod, Valibot, or Yup schemas generated instantly.
FAQ
Which validators are supported?
Zod, Valibot, and Yup. All three outputs are generated from a single inference pass — switching tabs doesn't re-parse the input.
How are optional fields detected?
If a key is missing in any element of an array of objects, the generator marks that key as optional — the same heuristic used by the JSON to TypeScript tool. Top-level keys are required unless null and the 'Treat null as optional' toggle is on.
What does 'Treat null as optional' do?
When on, any field whose value is null gets wrapped in the validator's nullable modifier — .nullable() for Zod/Yup, v.nullable() for Valibot — making it accept both the typed value and null.
What does 'Strict mode' do?
Strict mode rejects unknown keys on objects: .strict() in Zod, v.strictObject() in Valibot, .noUnknown(true) in Yup. Useful when you want the schema to be an exact shape contract rather than a minimum requirement.
How are mixed-type arrays handled?
The element types are collected and wrapped in a union — z.array(z.union([…])) for Zod, v.array(v.union([…])) for Valibot. Yup doesn't have first-class union support, so mixed arrays emit yup.array() without a typed element.