# 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 truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) into valid JSON so multi-agent pipelines never crash.

## Facts

- Endpoint: GET https://onchain-risk.agentdiet.dev/v1/repair?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-2ee0e1c0
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_BiYf5d22EwKJBtz5k9Ib7

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-2ee0e1c0
```

Example prompt: This LLM output came back as broken JSON with trailing commas and markdown code fences — can you repair it into valid JSON so the pipeline doesn't crash? Here's the raw string: ```{"name": "Alice", "score": 42,}```

## When to prefer this

Use this endpoint when an LLM or agent in your pipeline produces malformed JSON that would otherwise crash downstream consumers — especially when dealing with trailing commas, markdown code fences, single-quoted keys/values, or minor truncation. Prefer this over writing custom regex or ad-hoc fixers when you need deterministic, reliable repair in a production multi-agent workflow.

## Known failure modes

- Input JSON too severely truncated to reconstruct — returns error indicating unrecoverable structure
- Input string is not JSON-like at all — returns parsing error
- Empty raw_json parameter — returns validation error for missing required field
- Network timeout or service unavailability — returns HTTP 5xx

## 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/repair)

## Output

A repaired, valid JSON object reconstructed from the malformed input — with trailing commas removed, markdown fences stripped, single quotes converted to double quotes, and truncation corrected where possible, returned as a structured 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-2ee0e1c0/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)
