# Deterministic A2A Broken-JSON Repair & Schema Validator

> Deterministic A2A Broken-JSON Repair & Schema Validator is a paid API for AI agents from preflight.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) so multi-agent pipelines never crash

## Facts

- Endpoint: GET https://preflight.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: preflight.agentdiet.dev
- Website: https://preflight.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-a88bfe5c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_MBD6LFGsWiRGRI-FF9Sjv

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 preflight-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-a88bfe5c
```

Example prompt: This JSON response from the LLM is broken — it has trailing commas and markdown code fences wrapped around it. Can you repair it so it's valid JSON I can actually use? Here it is: ```json {"name": "Alice", "score": 42, } ```

## When to prefer this

Choose this endpoint when your multi-agent pipeline receives LLM-generated JSON that fails standard JSON.parse() due to common LLM artifacts (trailing commas, markdown code fences, single quotes, truncation). It is especially valuable in automated swarm or A2A pipelines where a single malformed output would otherwise crash a downstream agent. Prefer this over writing custom regex-based fixers when you need a deterministic, hosted, paid-per-call solution that handles the full spectrum of LLM JSON failure modes without maintaining your own repair logic.

## Known failure modes

- Input JSON too severely malformed to deterministically repair — returns error indicating unrecoverable structure
- Empty or whitespace-only raw_json input — returns validation error
- Input JSON represents ambiguous structure where multiple valid repairs exist — may return best-effort result or error
- Payment failure via x402 protocol — returns HTTP 402 if USDC payment not settled
- Network timeout if input string is extremely large

## 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://preflight.agentdiet.dev/v1/repair)

## Output

A repaired, valid JSON object reconstructed from the malformed input. The response includes the corrected JSON structure with all common LLM-induced issues resolved — trailing commas removed, markdown fences stripped, single quotes converted to double quotes, and truncated structures closed — making it safe to parse programmatically.

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