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

Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines can process the result without crashing.

## Facts

- Endpoint: POST https://preflight.agentdiet.dev/v1/schema-repair?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-11-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-0bd9bcdd
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_HvZGiJQsQq3V476Uw-ByR

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

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

## When to prefer this

Choose this endpoint when LLM-generated JSON needs to be reliably fixed before downstream agent steps consume it — especially when you need deterministic, rule-based repair rather than another LLM inference pass. Ideal for multi-agent pipelines where JSON parsing errors would cascade into failures, or when you need consistent repair behavior without nondeterminism.

## Known failure modes

- Input is so severely malformed that deterministic repair is impossible — returns error response
- Input is empty or below minimum length — returns 400 validation error
- JSON structure is ambiguous after truncation and cannot be reliably inferred — repair may be incomplete
- Network or service timeout — agent should retry with Idempotency-Key header to avoid duplicate processing

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

## Output

A repaired, syntactically valid JSON object corrected from the malformed input — with trailing commas removed, markdown fences stripped, single quotes converted to double quotes, and truncated structures closed — ready for downstream parsing and processing.

## 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-0bd9bcdd/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)
