# 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, malformed, or markdown-wrapped JSON strings (trailing commas, single quotes, fences) so multi-agent pipelines receive valid, parseable JSON.

## Facts

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

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

Example prompt: This JSON from my LLM has trailing commas, single quotes, and a markdown code fence around it — can you fix it so it's valid and parseable: ```{'name': 'Alice', 'age': 30,}```?

## When to prefer this

Choose this endpoint when an AI agent or multi-agent pipeline receives LLM-generated JSON that fails to parse due to common syntax issues like trailing commas, single quotes, markdown code fences, or truncation. It is specifically designed for agentic workflows where downstream JSON parsing failures would crash the pipeline. Prefer it over manual string manipulation or regex hacks when you need deterministic, reliable JSON repair as a microservice. It is not suitable for semantic validation, schema enforcement beyond basic repair, or fixing deeply corrupted non-JSON content.

## Known failure modes

- Input is so severely malformed or truncated that deterministic repair is impossible — returns an error or best-effort partial result
- Input JSON is actually valid but contains semantic errors — endpoint fixes syntax only, not logic
- Very large JSON payloads may hit query string length limits since raw_json is passed as a GET query parameter
- Non-JSON input (e.g. plain text, binary) may produce unexpected repair attempts or errors
- Payment failure via x402 protocol results in 402 response before any repair is attempted

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

## Output

Returns a JSON object containing the repaired, syntactically valid JSON string derived from the malformed input. The output should be parseable by any standard JSON parser, with issues like trailing commas, markdown fences, single quotes, and truncation corrected deterministically.

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