JSON to Zod
Turn JSON into Zod validation schemas, with refined checks for emails, URLs, UUIDs and dates.
Pay by wallet (x402)
json-to-zod Example
Example answer
{
"zod_schema": "import { z } from \"zod\";\n\nconst rootSchema = z.object({\n name: z.string(),\n value: z.number().int(),\n});",
"root_schema": "rootSchema",
"schema_count": 1
} Inputs
| Field | Type | Required | What it is |
|---|---|---|---|
json | any | Yes | JSON string or object |
root_name | string | No | — |
Output fields
How reliably each field appears in a successful answer.
| Field | Type | Appears |
|---|---|---|
zod_schema | string | Always (present in every successful answer) |
root_schema | string | Always (present in every successful answer) |
schema_count | integer | Always (present in every successful answer) |
How to call it
The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.
# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
-H "Authorization: Bearer $STRALE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"capability_slug": "json-to-zod",
"inputs": {
"json": "{\"name\": \"Test\", \"value\": 42}"
},
"max_price_cents": 5
}' {
"tool": "strale_execute",
"arguments": {
"slug": "json-to-zod",
"inputs": {
"json": "{\"name\": \"Test\", \"value\": 42}"
},
"max_price_cents": 5
}
} import { Strale } from "straleio";
const strale = new Strale({ apiKey: process.env.STRALE_API_KEY! });
const result = await strale.do({
capability_slug: "json-to-zod",
inputs: {
"json": "{\"name\": \"Test\", \"value\": 42}"
},
max_price_cents: 5,
}); import os
from straleio import Strale, DoRequest
strale = Strale(api_key=os.environ["STRALE_API_KEY"])
result = strale.do(DoRequest(
capability_slug="json-to-zod",
inputs={
"json": "{\"name\": \"Test\", \"value\": 42}",
},
max_price_cents=5,
)) # No account. The first request answers 402 with the price in USDC;
# an x402 client pays it from your wallet and repeats the request.
curl -i 'https://api.strale.io/x402/v2/json-to-zod?json=%7B%22name%22%3A+%22Test%22%2C+%22value%22%3A+42%7D' Limitations
String format constraints are not inferred
Generates Zod schemas from JSON samples — string format constraints (email, URL, date) are not inferred automatically
What to do instead: Add .email(), .url(), or .datetime() refinements manually for fields that require format validation
Related tools
- Agent Trace Analysis €0.20
- API Docs Generator €0.20
- API Mock Responses €0.05
- Changelog Generator €0.03
- Code Converter €0.05
- Commit Message Generator €0.05