# Deterministic A2A Broken-JSON Repair & Schema Validator

> Deterministic A2A Broken-JSON Repair & Schema Validator is a paid API for AI agents from token-intel.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) into valid, parseable JSON to prevent multi-agent pipeline crashes.

## Facts

- Endpoint: GET https://token-intel.agentdiet.dev/v1/structured-output?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Provider: token-intel.agentdiet.dev
- Website: https://token-intel.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/token-intel-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-fe89bb0b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_S3sqn20M4SlZAjenNy3dx

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 token-intel-agentdiet-dev-deterministic-a2a-broken-json-repair-schema-fe89bb0b
```

Example prompt: The LLM just returned this broken JSON with trailing commas and markdown fences — can you repair it into valid, parseable JSON so our pipeline doesn't crash? Here it is: ```json {"name": "Alice", "score": 95, } ```

## When to prefer this

Choose this endpoint when your multi-agent or LLM pipeline receives structured JSON outputs that are malformed, truncated, or wrapped in markdown fences and you need a deterministic (non-LLM) fix rather than asking another model to re-parse. Ideal for production pipelines where reliability matters and you cannot afford downstream crashes from bad JSON. Prefer over prompt-engineering workarounds when you need a programmatic, repeatable repair step.

## Known failure modes

- Input JSON too severely truncated or corrupted to deterministically repair — returns error indicating ambiguous repair
- Empty or null raw_json parameter — returns 400 bad request
- Input is not recognizable as JSON at all (e.g. plain prose) — may return error or unexpected output
- Payment not processed (HTTP 402) — request blocked until x402 micropayment is completed

## 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://token-intel.agentdiet.dev/v1/structured-output)

## Output

A JSON object containing the repaired, valid JSON that was reconstructed from the malformed input. The response corrects issues like trailing commas, markdown code fences, single-quoted keys/values, truncated structures, and other common LLM JSON formatting errors.

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