JSON to Zod Schema Generator
Sample inference only. Missing keys across object-array samples become optional; null stays nullable, mixed arrays use a union or a general JSON value, and empty arrays carry no element-type evidence. A single sample cannot establish required fields. Output is text only; data stays in this page.
Sample inference only. Missing keys across object-array samples become optional; null stays nullable, mixed arrays use a union or a general JSON value, and empty arrays carry no element-type evidence. A single sample cannot establish required fields. Output is text only; data stays in this page.
Paste JSON, then generate.
Targets Zod 3 syntax; z.unknown() for empty arrays, deduplicated unions for different observed types. JSON key spelling is preserved and quoted. Optional is a draft choice; unknown keys follow Zod object defaults. No schema is executed.
Invalid JSON or limit exceeded: 100,000 input characters, depth 30, 10,000 nodes, 200,000 output characters. Nonfinite or unsafe integer numbers are rejected.
A QUICK WALKTHROUGH
How to use this tool
- Paste a bounded JSON sample.
- Choose optional fields, then generate.
- Review the draft and copy it.
Draft output
Targets Zod 3 syntax; z.unknown() for empty arrays, deduplicated unions for different observed types. JSON key spelling is preserved and quoted. Optional is a draft choice; unknown keys follow Zod object defaults. No schema is executed.
JSON sample
Invalid JSON or limit exceeded: 100,000 input characters, depth 30, 10,000 nodes, 200,000 output characters. Nonfinite or unsafe integer numbers are rejected.
GOOD TO KNOW
Common questions
Is the generated schema executed?
No. It is a Zod 3 syntax draft for your review. Empty arrays use z.unknown(); differing observed types produce deduplicated unions. A sample does not establish the complete data contract.