JSON to Zod & JSON Schema
Infer Zod validators and JSON Schema from example JSON. Add a short description like a prompt for agents and docs. Free, private.
Privacy: Example JSON never leaves this browser.
How to Use
- 1Paste a representative JSON example (or multiple samples / NDJSON).
- 2Name the schema and optionally describe it for agents/docs.
- 3Infer, then copy Zod into TypeScript or JSON Schema into your API tooling.
What gets inferred
Formats
email · uuid · url · datetime from string samplesHeuristic format detection from values.
Nesting
objects, arrays, and optional fields across merged samplesMissing keys in some samples become .optional().
Tips
- •Use realistic examples — inferred schemas follow the samples you provide.
- •Merge multiple samples to capture optional fields correctly.
- •Tighten enums and unions manually when business rules are richer than examples.
- •For OpenAPI operations, prefer OpenAPI to Tool Schemas.
Frequently Asked Questions
How does JSON to Zod / JSON Schema work?
Paste one or more example JSON values. Instant Tools infers types, nested objects, arrays, and common string formats (email, uuid, url, datetime), then emits Zod TypeScript and JSON Schema draft 2020-12. Optional description text documents the schema like a short prompt.
Is this an AI prompt-to-schema model?
No LLM call is required. Inference is deterministic and 100% client-side from your examples. Use the description field to capture intent for agents and docs.
Can I pass multiple samples?
Yes. Paste an array of objects as separate JSON documents, or NDJSON (one object per line). Samples are merged so optional fields stay optional when missing in some examples.
Does my JSON leave the browser?
No. Parsing and codegen never upload your payload.
When should I use OpenAPI to Tool Schemas instead?
If you already have an OpenAPI/Swagger file, use OpenAPI to Tool Schemas for operation-level agent tools. Use this tool when you only have example JSON payloads.