Can I generate nested models from JSON?
Yes. The generator supports nested objects and arrays and outputs corresponding nested model definitions.
Generate Zod schemas and inferred TypeScript types from JSON examples for runtime validation at API boundaries.
{
"id": 101,
"name": "Ada Lovelace",
"active": true,
"roles": ["admin", "editor"],
"profile": {
"email": "ada@example.com",
"score": 9.8
}
}
import { z } from "zod";
export const UserModelSchema = z.object({
id: z.number(),
name: z.string(),
active: z.boolean(),
roles: z.array(z.string()),
profile: z.object({
email: z.string(),
score: z.number()
})
});
Yes. The generator supports nested objects and arrays and outputs corresponding nested model definitions.
Yes. Use the Force Optional toggle in the app toolbar when you need optional fields in the generated output.
Zod adds runtime validation while still generating static TypeScript types, reducing unsafe assumptions from unknown JSON.