# AgentDiet JSON Validator & Repair

> AgentDiet JSON Validator & Repair is a paid API for AI agents from agentdiet.dev, paid per call via x402 or MPP, $0.002/call, status unknown (last checked 2026-10-20).

Repairs malformed or truncated LLM JSON outputs (trailing commas, markdown fences, single quotes) and validates them against a schema so multi-agent pipelines don't crash.

## Facts

- Endpoint: GET https://agentdiet.dev/v1/json-validator?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402, MPP
- Status: unknown
- Last checked: 2026-10-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agentdiet-json-validator-repair-7518e3b7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Hilh8Y5q2eYgQxrKE-mHv

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 agentdiet-json-validator-repair-7518e3b7
```

Example prompt: This JSON from the LLM has trailing commas and markdown code fences wrapping it — can you run it through the JSON repair validator and give me back clean, parseable JSON? Here it is: ```json {"name": "Alice", "score": 42,} ```

## When to prefer this

Choose this endpoint when an LLM or AI agent in your pipeline is producing syntactically invalid JSON (trailing commas, markdown fences, single quotes, truncation) and you need a deterministic, lightweight repair before passing data to a downstream step. Prefer this over manual string-munging or custom regex when reliability and schema validation matter in automated multi-agent workflows.

## Known failure modes

- Input JSON too severely corrupted to repair — returns error indicating irrecoverable structure
- Empty or null raw_json query parameter — returns validation error
- Non-JSON input (e.g. plain text blob) passed as raw_json — may return partial repair or failure
- Rate-limit or payment failure for x402 micropayment — returns 402 Payment Required

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

## Output

Returns a repaired, schema-conformant JSON object with any syntax errors corrected — trailing commas removed, markdown fences stripped, single quotes converted to double quotes, and truncated structures closed — ready for downstream consumption in a multi-agent pipeline.

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