# Deterministic A2A Broken-JSON Repair & Schema Validator

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

Repairs malformed, truncated, or LLM-generated JSON strings (trailing commas, markdown fences, single quotes) and returns valid, parseable JSON for use in multi-agent pipelines.

## Facts

- Endpoint: GET https://onchain-risk.agentdiet.dev/v1/llm-json-schema-healer?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Provider: onchain-risk.agentdiet.dev
- Website: https://onchain-risk.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/onchain-risk-agentdiet-dev-deterministic-a2a-broken-json-repair-13be3a7d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_zv1mk7sFAruwpRer6hQNC

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 onchain-risk-agentdiet-dev-deterministic-a2a-broken-json-repair-13be3a7d
```

Example prompt: This JSON from the LLM is broken — it has trailing commas, single quotes, and a markdown code fence wrapping it. Can you repair it so I can parse it? Here it is: ```{'name': 'Alice', 'age': 30,}```

## When to prefer this

Choose this endpoint when your multi-agent or LLM pipeline receives JSON that fails JSON.parse() due to common LLM formatting errors (trailing commas, markdown fences, single quotes, minor truncation). It is deterministic and cheap ($0.002/call), making it suitable for inline pipeline healing before downstream processing steps. Prefer this over custom regex patching when you need a reliable, hosted, low-latency fix without maintaining your own JSON repair logic.

## Known failure modes

- Input JSON too severely truncated or corrupted to recover — returns an error indicating unrecoverable structure
- Input string is not JSON-like at all — endpoint may return an error or unexpected output
- Ambiguous JSON structure where multiple repairs are plausible — deterministic repair may not match original intent
- Empty or whitespace-only raw_json input — validation error returned

## 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://onchain-risk.agentdiet.dev/v1/llm-json-schema-healer)

## Output

A repaired, valid JSON object ready for programmatic parsing. The endpoint deterministically fixes common LLM JSON errors including trailing commas, single-quoted keys/values, markdown code fences, and truncated structures, returning a well-formed JSON response.

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