# AgentJSON Fix

> AgentJSON Fix is a paid API for AI agents from agentjson-fix-km.fly.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-11).

Deterministically repairs malformed or LLM-style JSON strings into valid, parseable JSON, with optional schema validation.

## Facts

- Endpoint: GET https://agentjson-fix-km.fly.dev/v0/json/fix?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agentjson-fix-ae7673c4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__nJ1YerXzC79jVDgLrkQX

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 agentjson-fix-ae7673c4
```

Example prompt: Can you fix this broken JSON for me? It has single quotes and trailing commas: {'name': 'agent', 'ok': true,} — I need it as valid JSON.

## When to prefer this

Choose this endpoint when you need fast, deterministic, rule-based JSON repair without relying on another LLM call. It is especially suited for fixing LLM-generated JSON that has predictable issues like single quotes, trailing commas, or unquoted keys. Prefer it over regex hacks or manual parsing logic when you want a consistent, auditable repair log. It also supports optional JSON Schema validation in one call, making it useful in pipelines that need both repair and conformance checking.

## Known failure modes

- JSON is so deeply malformed it cannot be deterministically repaired — returns ok:false
- Schema validation fails in strict mode — returns ok:false with validation details
- Missing required 'raw' parameter — returns an error response
- Input is not a string — request rejected
- Schema object itself is malformed — validation step may be skipped or error returned

## How this service works

Deterministic repair of broken or LLM-style JSON into valid JSON, $0.005 per call via x402.

## Output

Returns a JSON object with an 'ok' boolean indicating success, the repaired 'json' value as a parsed object, and a 'repairs' array listing each type of fix applied (e.g. single_quotes converted, trailing_commas removed). If schema validation is enabled and strict mode is on, returns ok:false on validation failure.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "raw": {
   "type": "string",
   "description": "Malformed or LLM-ish JSON text to repair (required)"
  },
  "schema": {
   "type": "object",
   "description": "Optional JSON Schema object to validate the repaired value"
  },
  "strict": {
   "type": "boolean",
   "description": "If true, schema validation failures return ok:false; default false"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "json": {
   "ok": true,
   "name": "agent"
  },
  "repairs": [
   {
    "type": "single_quotes",
    "detail": "converted 2"
   },
   {
    "type": "trailing_commas",
    "detail": "removed 1"
   }
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agentjson-fix-ae7673c4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agentjson-fix-km.fly.dev](https://www.zero.xyz/host/agentjson-fix-km.fly.dev/llms.txt)
