# Deterministic JSON Repair & Schema Validator

> Deterministic JSON Repair & Schema Validator is a paid API for AI agents from polymarket-odds.agentdiet.dev, paid per call via MPP, $0.002/call, status unknown (last checked 2026-10-21).

Repairs malformed, truncated, or markdown-wrapped LLM JSON outputs (trailing commas, single quotes, fenced code blocks) so they become valid, parseable JSON

## Facts

- Endpoint: GET https://polymarket-odds.agentdiet.dev/v1/structured-output?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Provider: polymarket-odds.agentdiet.dev
- Website: https://polymarket-odds.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/polymarket-odds-agentdiet-dev-deterministic-json-repair-schema-c0f2c954
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_5PrkUJC8xLvOAOU6UMjzn

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 polymarket-odds-agentdiet-dev-deterministic-json-repair-schema-c0f2c954
```

Example prompt: This JSON from my LLM response is broken — it has trailing commas and markdown code fences wrapping it. Can you repair it so it's valid JSON I can parse? Here's the raw string: ```json {"name": "Alice", "age": 30, } ```

## When to prefer this

Use this endpoint when an LLM or agent in your pipeline produces structurally invalid JSON that would crash a downstream parser — especially when the issues are predictable syntax errors like trailing commas, markdown wrapping, or single quotes. Prefer this over re-prompting the LLM when speed and determinism matter more than semantic correction. Ideal for multi-agent workflows where you cannot afford pipeline failures due to malformed JSON.

## Known failure modes

- Input is so severely malformed that deterministic repair is impossible — may return an error or best-effort partial result
- Input string is not JSON-like at all (e.g. plain text prose) — repair may fail or produce nonsensical output
- Extremely long truncated JSON may not be recoverable without missing context
- Rate limiting or payment failure via x402 if USDC balance is insufficient

## How this service works

Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines never crash. (Live x402 v2, IETF MPP & MCP endpoint at https://polymarket-odds.agentdiet.dev/v1/structured-output)

## Output

Returns a repaired, valid JSON object where all syntax errors — trailing commas, markdown fences, single quotes, truncation — have been deterministically corrected, ready to be parsed or passed to the next stage of an agent pipeline.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "raw_json"
 ],
 "properties": {
  "raw_json": {
   "type": "string",
   "minLength": 1,
   "description": "Malformed, truncated, or markdown-wrapped JSON string to deterministically repair"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/polymarket-odds-agentdiet-dev-deterministic-json-repair-schema-c0f2c954/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from polymarket-odds.agentdiet.dev](https://www.zero.xyz/host/polymarket-odds.agentdiet.dev/llms.txt)
