# Deterministic A2A Broken-JSON Repair & Schema Validator

> Deterministic A2A Broken-JSON Repair & Schema Validator is a paid API for AI agents from json-repair.agentdiet.dev, paid per call via MPP, $0.002/call, status unknown (last checked 2026-10-21).

Repairs truncated or malformed JSON strings (trailing commas, markdown fences, single quotes, truncation) so multi-agent pipelines receive valid, parseable JSON

## Facts

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

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

Example prompt: This LLM response came back as broken JSON with trailing commas and markdown code fences — can you repair it so I can parse it? Here's the raw string: ```{"name": "Alice", "age": 30,}```

## When to prefer this

Choose this endpoint when your AI agent pipeline receives JSON output from an LLM that fails JSON.parse() due to common LLM formatting errors like trailing commas, markdown code fences, single quotes, or mid-generation truncation. It is purpose-built for deterministic, rule-based repair rather than probabilistic rewriting, making it reliable for production multi-agent pipelines where consistency matters. Prefer this over manually writing repair logic or prompting the LLM to retry, especially when you need low-latency, per-call fixes without burning additional LLM tokens.

## Known failure modes

- Input so severely malformed that deterministic repair cannot recover a valid structure — returns an error or best-effort partial result
- Extremely long JSON strings may hit query parameter length limits when passed via GET
- Ambiguous truncation points may result in incorrect inferred structure closing
- Empty or whitespace-only raw_json input returns a validation error

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

## Output

A repaired, valid JSON object derived from the input malformed string, with markdown fences stripped, trailing commas removed, single quotes normalized to double quotes, and truncated structures closed — ready for immediate programmatic parsing.

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