# 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, truncation) so multi-agent pipelines can continue without crashing.

## Facts

- Endpoint: POST https://preflight.agentdiet.dev/v1/malformed-json-healer?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-7977c334
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_893yzF-P8mvy0oHgJCsCM

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

Example prompt: This JSON from the LLM response is broken — it has trailing commas, markdown backtick fences, and got cut off mid-object. Can you repair it so the pipeline doesn't crash? Here's the raw string: ```{"name": "Alice", "age": 30, "tags": ["dev", "ml",]}```

## When to prefer this

Choose this endpoint when you have LLM-generated or agent-produced JSON that fails standard JSON.parse due to common artifacts like trailing commas, markdown wrapping, single quotes, or truncation, and you need a deterministic (non-LLM) repair rather than sending the broken payload back to a language model. Particularly valuable in high-reliability multi-agent pipelines where a crashed parser blocks downstream steps and retrying the LLM is too costly or slow.

## Known failure modes

- Input is so severely malformed that deterministic repair is impossible — returns error indicating unrecoverable JSON
- Input string is empty or null — returns validation error for missing required field
- JSON is structurally ambiguous (e.g. multiple competing interpretations of truncation point) — may return best-effort repair with low confidence
- Network timeout or service unavailability — returns HTTP 5xx
- Payment not fulfilled — returns HTTP 402 requiring x402 payment flow

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

## Output

Returns a repaired, valid JSON object that has been sanitized of common LLM output artifacts such as trailing commas, markdown code fences, single quotes, and truncation errors — ready for downstream parsing and schema validation in agent pipelines.

## 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-7977c334/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)
