# 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-11-18).

Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines never crash

## Facts

- Endpoint: POST https://onchain-risk.agentdiet.dev/v1/json-fix?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-11-18
- 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-f9fc8cb2
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_UN2L0v0XcgbeMWewSvgQ4

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-f9fc8cb2 -d '<json body>'
```

Example prompt: This JSON from my LLM has trailing commas and markdown code fences and it's crashing my pipeline — can you clean it up and give me valid JSON back? Here it is: ```json {"name": "Alice", "score": 42,} ```

## When to prefer this

Choose this endpoint when you need deterministic, rule-based JSON repair rather than LLM-based rewriting — it's ideal for multi-agent pipelines where consistency and predictability matter more than inference. Prefer it over manual regex fixes or retry loops when LLM outputs frequently arrive with trailing commas, markdown fences, or single quotes. It's especially valuable in production agent workflows where crashes from malformed JSON are unacceptable and you need a cheap, fast, idempotent sanitization step.

## Known failure modes

- Input is so severely malformed that deterministic repair cannot infer the original structure — returns error indicating unrecoverable JSON
- Input string is empty or missing the required raw_json field — returns 400-level validation error
- Ambiguous truncation where multiple valid completions exist — repair may produce unexpected but syntactically valid output
- Payment not provided or insufficient — returns HTTP 402 requiring x402 micropayment
- Rate limiting or service unavailability — returns 5xx error

## 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, fully valid JSON object with all syntax errors corrected — trailing commas removed, markdown fences stripped, single quotes converted to double quotes, and truncated structures closed. The response is a JSON object containing the fixed output ready for downstream parsing.

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