JSON to Zod generates a runtime-safe Zod schema directly from any JSON object. Paste your JSON, choose a schema name and options, and get a fully typed Zod schema with optional Auto-JSDoc and branded ID types — ready to paste into any TypeScript project in one click.
JSON to Zod
Generate Zod schemas with JSDoc and branded types from any JSON
How to use
- Paste your JSON — Enter or paste any valid JSON object into the input textarea.
- Name your schema — Set a schema name — it becomes the exported const identifier.
- Choose options — Toggle strict, coerce, Auto-JSDoc, branding, and pick a date strategy.
- Run — Click Run or press Ctrl+Enter. The Zod schema generates instantly.
- Copy — Click Copy to grab the import, schema, and TypeScript types together.
MCP / API
Call json_to_zod directly from any MCP-compatible agent:
// MCP TypeScript SDK
const result = await client.callTool({
name: "json_to_zod",
arguments: {
"json": "...",
"schemaName": "..."
}
});
// curl
curl -X POST https://obfus.link/mcp \
-H "Authorization: Bearer <SPT>" \
-H "Content-Type: application/json" \
-d '{"method":"tools/call","params":{"name":"json_to_zod","arguments":{"json":"...","schemaName":"..."}}}'Related tools
FAQ
What is a Zod schema?
A Zod schema is a TypeScript-first validation object that describes the shape and types of your data. It provides runtime safety and static type inference via z.infer<>.
What are branded types?
Branded types (z.brand()) add a phantom type tag to a string, making it impossible to accidentally assign a plain string where a UserId is expected — even though they're the same runtime value.
Which date strategy should I choose?
"string" keeps dates as validated ISO strings. "coerce" parses them into JavaScript Date objects. "pipe" validates the string format first, then coerces — the safest option for untrusted input.
Does this work with nested JSON?
Yes. Nested objects generate nested z.object() calls at any depth. Arrays generate z.array() using the first element's type as the item schema.
Can I use this tool via the MCP API?
Yes. The tool is registered on the obfus.link MCP server at https://obfus.link/mcp. Call it from any MCP-compatible agent with a Shared Payment Token. The MCP tool name matches the snake_case slug shown in the integration snippet.