# JSON Repair API (x402 Pay-per-call)

> JSON Repair API (x402 Pay-per-call) is a paid API for AI agents from x402-micro-pay.com, paid per call via x402, $0.0041/call, status unknown (last checked 2026-11-20).

Repairs malformed or invalid JSON strings by fixing common syntax errors and returning the corrected JSON along with a list of applied fixes.

## Facts

- Endpoint: POST https://x402-micro-pay.com/api/skills/json-repair?utm_source=zero.xyz
- Price: $0.0041/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-repair-api-x402-pay-per-call-72e6b288
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Mm87gYuLjjNAucFW-eZIn

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-api-x402-pay-per-call-72e6b288 -d '<json body>'
```

Example prompt: This JSON string from the API response has trailing commas and single quotes and won't parse — can you repair it and give me back valid JSON? Here it is: {name: 'Ada', tags: ['math', 'code'], active: True,}

## When to prefer this

Choose this endpoint when you have a JSON string that fails to parse due to common syntax issues like unquoted keys, single quotes, trailing commas, Python literals (True/False/None), or inline comments. It is ideal for fixing LLM-generated JSON, scraped data, or config files without writing custom repair logic. Prefer this over custom regex fixes when you need reliable, categorized repair with a log of what was changed.

## Known failure modes

- Input text is so malformed it cannot be repaired — returns error or ok:false
- Input exceeds 400,000 character limit — rejected
- Payment not provided — HTTP 402 returned requiring USDC payment on Base via x402
- Network timeout if input is very large
- JSON is structurally unrecoverable (e.g. completely arbitrary text with no JSON structure)

## How this service works

41 pay-per-call JSON APIs for AI agents. No account or API key: an unpaid POST returns HTTP 402, pay in USDC on Base with x402 v2, retry. Prices from $0.001 per call.

## Output

Returns a JSON object with: 'ok' (boolean success flag), 'json' (the parsed repaired object), 'repaired' (the repaired JSON as a string), 'fixes' (array of fix types applied such as unquoted_keys, single_quotes, trailing_commas, python_literals, removed_comments), 'changed' (boolean indicating whether any changes were made), and 'skill' identifier.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "maxLength": 400000,
   "minLength": 1
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "json": {
   "name": "Ada",
   "tags": [
    "math",
    "code"
   ],
   "active": true
  },
  "fixes": [
   "unquoted_keys",
   "single_quotes",
   "trailing_commas",
   "python_literals",
   "removed_comments"
  ],
  "skill": "json_repair",
  "changed": true,
  "repaired": "{\"name\":\"Ada\",\"tags\":[\"math\",\"code\"],\"active\":true}"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-repair-api-x402-pay-per-call-72e6b288/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-micro-pay.com](https://www.zero.xyz/host/x402-micro-pay.com/llms.txt)
