# 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-generated JSON (trailing commas, markdown fences, single quotes) so multi-agent pipelines can continue without crashing.

## Facts

- Endpoint: GET https://onchain-risk.agentdiet.dev/v1/json-fix?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-b76aaf86
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_xwxDL_8aiC8UUPUkcl2zV

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-b76aaf86
```

Example prompt: This JSON from my LLM pipeline is broken — it has trailing commas and markdown fences wrapping it. Can you fix it so it's valid JSON I can parse? Here's the raw output: ```{"name": "Alice", "score": 42,}```

## When to prefer this

Choose this endpoint when your multi-agent or LLM pipeline receives syntactically broken JSON that needs deterministic, rule-based repair rather than AI-based rewriting. Ideal for stripping markdown fences, fixing trailing commas, correcting single quotes, or closing truncated structures. Prefer this over custom parsing logic when you need a reliable, low-latency, pay-per-call fix that integrates with x402/MCP infrastructure.

## Known failure modes

- Input JSON is too severely corrupted to deterministically repair — returns error indicating unrecoverable structure
- raw_json parameter missing or empty — returns 400-level validation error
- Input is not JSON-like at all (e.g. plain text or binary) — repair may fail or return unexpected output
- Very long truncated JSON may have ambiguous completion — repaired output may not match original intent

## 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/json-fix)

## Output

A repaired, valid JSON object derived from the malformed input string. The response contains the fixed JSON with syntax errors corrected, markdown fences stripped, single quotes replaced with double quotes, trailing commas removed, and truncated structures closed where possible.

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