About this conversion
In this example, the pasted JSON object is inferred into a Zod schema: every string becomes z.string(), the boolean becomes z.boolean(), the array becomes z.array(z.string()), and the nested profile object becomes its own z.object({ plan: z.string(), seats: z.number() }). The null-valued key maps to z.null(), so the generated schema validates the exact shape you pasted.
Key Syntax Transformations
z.object() at every level
Nested objects become nested z.object({...}) schemas, preserving the payload's structure one-to-one instead of flattening it.
.optional() from evidence
Keys that are sometimes absent across the pasted sample are marked .optional(), so the schema accepts the real-world shape of your API responses.
z.union() and .nullable()
Mixed-type values become z.union([...]) and keys that can be null become .nullable() — the two shapes Zod uses to keep validation honest.
.transform() for awkward keys
Keys that are not valid JavaScript identifiers are kept verbatim and remapped inside a .transform() step, so even exotic payloads round-trip.
Frequently Asked Questions
Is my JSON uploaded to a server?
No. Schema inference and generation run entirely in your browser — nothing is transmitted, stored, or logged, which matters for payloads containing customer data.
Which Zod version is the generated schema for?
The output uses the stable Zod 3 API surface (z.object, z.string, z.union, .optional(), .nullable()) and works with Zod 3 and later.
What happens if my JSON has inconsistent types?
A key holding different types across the sample is inferred as a z.union() of the observed variants instead of silently picking one — the schema reflects reality.
Is the generator really free?
Yes — no sign-up, no rate limits, no logging. Because everything runs client-side there is no backend cost to pass on.