obfus.link

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.

Tier 2generators✓ TDD Verified

JSON to Zod

Generate Zod schemas with JSDoc and branded types from any JSON

How to use

  1. Paste your JSONEnter or paste any valid JSON object into the input textarea.
  2. Name your schemaSet a schema name — it becomes the exported const identifier.
  3. Choose optionsToggle strict, coerce, Auto-JSDoc, branding, and pick a date strategy.
  4. RunClick Run or press Ctrl+Enter. The Zod schema generates instantly.
  5. CopyClick Copy to grab the import, schema, and TypeScript types together.
Read technical article

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

cURL to Fetch
Convert curl commands to fetch, axios, got, ky, or node-fetch
Regex Verifier
Verify, generate, explain, and translate regular expressions
LLM to JSON Cleaner
Repair malformed JSON from LLM responses with confidence scoring

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.