Tool Kumar tool
JSON to Zod
Paste example JSON and get a Zod schema you can add to a TypeScript project. The generated checks mirror the values and nesting in your sample.
How to use this tool
- Paste the JSON shape your application receives.
- Open the convert view and choose Zod schema.
- Change the root name and copy the generated code.
Worked example
Tool Kumar generates this schema from the sample object.
Input
{"name":"Ada","age":36,"active":true,"tags":["json","tools"],"profile":{"city":"London"}}Output
import { z } from "zod";
export const ProfileSchema = z.object({
city: z.string(),
});
export type Profile = z.infer<typeof ProfileSchema>;
export const RootSchema = z.object({
name: z.string(),
age: z.number().int(),
active: z.boolean(),
tags: z.array(z.string()),
profile: ProfileSchema,
});
export type Root = z.infer<typeof RootSchema>;
Options and edge cases
- Nested objects become nested z.object calls.
- Arrays use the inferred item schema.
- The output is code only. Add project-specific refinements such as email or minimum length yourself.
Private by default
Your document stays in this browser. Tool Kumar parses, converts and creates downloads on your device, with no account or upload step.
JSON to Zod questions
- Does this create a complete API validator?
- It creates a Zod schema for the sample shape. Add refinements for rules that the sample cannot reveal.
- How are nulls handled?
- Null values become z.null() in the generated schema.
- Can I rename the root schema?
- Yes. Set the root name in the converter toolbar.