# AgentDiet JSON Repair

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

Repairs and normalizes malformed JSON strings, returning cleaned valid JSON with a compression/ROI proof metric

## Facts

- Endpoint: GET https://onchain-risk.agentdiet.dev/v1/json-repair?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-repair-f45df64e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_KDcdn4UTtp9Mkj0eKiZCh

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-repair-f45df64e
```

Example prompt: I have this broken JSON string that won't parse — can you run it through AgentDiet's JSON repair to fix the syntax errors and give me back valid, clean JSON?

## When to prefer this

Use this endpoint when you need a lightweight, pay-per-call JSON repair service accessible via simple GET request with USDC micropayment (x402). Prefer it over client-side JSON parsers when you need a reliable cloud-based fix for LLM outputs, scraped data, or corrupted API responses, especially in agent pipelines where bad JSON would otherwise break downstream steps.

## Known failure modes

- Input JSON is too malformed to be repaired — returns error status
- Missing required 'raw_json' query parameter — returns validation error
- Network timeout or service unavailability
- Input exceeds maximum size limits — returns size error

## How this service works

15-App Autonomous Business-to-Agent (B2A) API Hub & MCP Suite. Supports Web Distillation, On-Chain Risk, DEX Token Intelligence, B2B Lead Enrichment, Domain OSINT, Email Verification, SEC Filings, GitHub Audits, Prompt Firewall, and native HTTP 402 (x402 Base USDC).

## Output

Returns a JSON object with a 'data' field containing the repaired JSON, a 'status' field ('ok' on success), and a 'roi_proof' object containing 'compression_ratio_pct' indicating how much the input was cleaned/compressed as a percentage.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "POST"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "raw_json": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {},
  "status": "ok",
  "roi_proof": {
   "compression_ratio_pct": 91.4
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agentdiet-json-repair-f45df64e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from onchain-risk.agentdiet.dev](https://www.zero.xyz/host/onchain-risk.agentdiet.dev/llms.txt)
