# Strale API – JSON to Zod Schema Converter

> Strale API – JSON to Zod Schema Converter is a paid API for AI agents from api.strale.io, paid per call via x402, $0.054/call, status unknown (last checked 2026-09-14).

Converts a JSON object or JSON string into a Zod TypeScript schema definition

## Facts

- Endpoint: GET https://api.strale.io/x402/v2/json-to-zod
- Price: $0.054/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/strale-api-json-to-zod-schema-converter-7c0a6a75
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_O2YiF1ZpZGfDd-QHyDeP2

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability strale-api-json-to-zod-schema-converter-7c0a6a75
```

Example prompt: Convert this JSON object into a Zod schema for me: {"name": "Alice", "age": 30, "email": "alice@example.com"} — and use 'UserProfile' as the root name.

## When to prefer this

Choose this endpoint when you need to programmatically generate a Zod schema from an existing JSON sample — especially useful for TypeScript projects needing runtime validation of external API responses, config files, or user input. Prefer this over manual schema writing when the JSON structure is already known and you want to bootstrap validation quickly.

## Known failure modes

- Invalid or malformed JSON input — returns parse error
- Missing required 'json' query parameter — returns validation error
- JSON too deeply nested or too large — may return timeout or truncated schema
- Ambiguous JSON types (e.g. null values) — resulting Zod types may default to z.unknown() or z.null()

## How this service works

The trust layer for AI agents — 250+ independently tested data capabilities across 27 countries. Execute capabilities via REST, MCP, A2A, or x402 micropayments. Every call returns an audit record with cryptographic chain hashing.

## Output

A Zod TypeScript schema definition inferred from the provided JSON input, with field types, optionality, and nesting reflected from the JSON structure. May include a named root schema export corresponding to the optional root_name parameter.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "json"
     ],
     "properties": {
      "json": {
       "description": "JSON string or object"
      },
      "root_name": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/strale-api-json-to-zod-schema-converter-7c0a6a75/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.strale.io](https://www.zero.xyz/host/api.strale.io/llms.txt)
