# Deterministic A2A Broken-JSON Repair & Schema Validator

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

Repairs malformed, truncated, or markdown-wrapped LLM JSON outputs deterministically so multi-agent pipelines can continue without crashing.

## Facts

- Endpoint: POST https://defi-yield.agentdiet.dev/v1/structured-output?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-23
- Activations on Zero: 0
- Provider: defi-yield.agentdiet.dev
- Website: https://defi-yield.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/defi-yield-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-dc4d4493
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YShUd_cu9ev5HEivl8vAu

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 defi-yield-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-dc4d4493 -d '<json body>'
```

Example prompt: This LLM response came back with malformed JSON — it has trailing commas, single quotes, and a markdown code fence wrapper. Can you clean it up and give me valid, parseable JSON?

## When to prefer this

Choose this endpoint when a multi-agent pipeline receives LLM-generated JSON that fails standard JSON.parse() due to common LLM formatting errors like trailing commas, markdown fences, or single quotes. It is especially valuable in agentic workflows where structured outputs from one model feed into another agent's input schema. Prefer it over custom regex-based repair logic when you need deterministic, reliable correction without maintaining your own sanitization code.

## Known failure modes

- Input is so severely malformed it cannot be deterministically repaired — returns error
- Input string is empty or whitespace-only — rejected by minLength:1 constraint
- JSON is semantically ambiguous after repair (e.g. duplicate keys) — may return partial result
- Network timeout or service unavailability — HTTP 5xx error
- Payment not provided or invalid — HTTP 402 payment required

## 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://defi-yield.agentdiet.dev/v1/structured-output)

## Output

A repaired, valid JSON object returned as a structured response. The output corrects issues such as trailing commas, markdown code fences, single-quoted keys or values, and truncation artifacts — producing parseable JSON that downstream agents and parsers can safely consume.

## 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/defi-yield-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-dc4d4493/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from defi-yield.agentdiet.dev](https://www.zero.xyz/host/defi-yield.agentdiet.dev/llms.txt)
