JSON to Zod schema generator
Infer a draft runtime schema with optionality controls.
วิธีใช้ JSON to Zod schema generator
The JSON to Zod schema generator takes one JSON example and returns TypeScript code that imports z from zod and exports a schema constant inferred from the example. Strings, numbers, booleans, null, nested objects and arrays are mapped to Zod types, with z.union for mixed arrays. You can rename the constant and mark every object property optional.
- Paste the source into the input editor, or load the built-in example.
- Adjust the basic settings, then open Advanced mode for export and fine-tuning options. Custom settings stay active when the panel is closed.
- Run json to zod schema generator, review the output, then use the available copy or download controls.
ความสามารถของเครื่องมือนี้
Infer a draft runtime schema with optionality controls.
- Schema constant name
- Set this value for your task.
- Make object properties optional
- Set this value for your task.
ข้อจำกัดและการประมวลผล
CSV/XLSX inputs are capped at 10 MB each, 200 columns and 20,000 rows; joined output is capped at 20,000 rows. JSONPath script/filter evaluation is disabled. Other operations apply their visible controls and text limits.
ตัวอย่างข้อมูลนำเข้า
{"name":"Alex","age":30,"active":true,"tags":["tools"]}คำถามที่พบบ่อย
How are arrays converted to Zod schemas?
Each element type is inferred and duplicates are merged. An array of one type becomes z.array(z.string()), mixed element types become z.array(z.union([...])), and an empty array becomes z.array(z.unknown()) because there is nothing to infer from.
How do I make all fields optional in the generated schema?
Turn on Make object properties optional. Every property in every object, including nested ones, gets .optional() appended. Without it, each property found in the example is required. Edit the code afterward if only some fields should be optional.
Why should I review the generated Zod schema?
The schema is inferred from a single example, so it cannot know which fields are sometimes missing, which strings are emails or enums, or what number ranges are valid. Add refinements such as .email() or .min() yourself. Nesting is limited to 30 levels.
Where is my input processed?
This operation processes its source in your browser. Copy and download are explicit actions; source input is not saved in an account or history.
What are the input limits?
CSV/XLSX inputs are capped at 10 MB each, 200 columns and 20,000 rows; joined output is capped at 20,000 rows. JSONPath script/filter evaluation is disabled. Other operations apply their visible controls and text limits.