# JSON Repair (Trailing Commas, Single Quotes, Code Fences, Python Literals)

> JSON Repair (Trailing Commas, Single Quotes, Code Fences, Python Literals) is a paid API for AI agents from twin.unykorn.org, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-01).

Repairs malformed JSON strings by fixing common syntax errors such as trailing commas, single quotes, code fences, and Python-style literals.

## Facts

- Endpoint: POST https://twin.unykorn.org/ai/json-repair?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-01
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-repair-trailing-commas-single-quotes-code-fences-python-literals-9e05f897
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YXXu08UHTmByQvQ5SydZa

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-trailing-commas-single-quotes-code-fences-python-literals-9e05f897 -d '<json body>'
```

Example prompt: This JSON string from the LLM response has trailing commas and single quotes instead of double quotes — can you fix it so it parses correctly? Here it is: {'name': 'Alice', 'age': 30,}

## When to prefer this

Use this endpoint when you need to programmatically fix malformed JSON produced by LLMs, scrapers, or legacy systems that emit trailing commas, single-quoted strings, Python-style literals (True/False/None), or markdown code fences. Prefer this over manual regex fixes when the malformation pattern is varied or unknown.

## Known failure modes

- Input text exceeds 20,000 character limit — request rejected
- Input is so severely malformed that valid JSON cannot be inferred — may return error or best-effort result
- Non-JSON input (e.g. plain prose) may produce unexpected output
- Network or payment failure via x402 protocol

## How this service works

Repair malformed JSON (trailing commas, single quotes, code fences, Python literals) — Genesis402 / UnyKorn Operator Network

## Output

Returns a syntactically valid, parseable JSON string with all common malformation issues resolved, including trailing commas removed, single quotes converted to double quotes, code fences stripped, and Python literals (True, False, None) converted to their JSON equivalents.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "params": {
   "type": "object",
   "properties": {
    "text": {
     "type": "string",
     "description": "required, up to 20,000 chars"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "type": "json-repair",
  "receipt": {
   "tx_hash": "0x<64hex>",
   "amount_usd": 0.002,
   "receipt_id": "g402-<16hex>"
  },
  "sources": [
   {
    "ok": true,
    "name": "<source>"
   }
  ],
  "limitations": "<text>",
  "generated_at": "<iso time>",
  "evidence_hash": "sha256:<64hex>"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-repair-trailing-commas-single-quotes-code-fences-python-literals-9e05f897/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from twin.unykorn.org](https://www.zero.xyz/host/twin.unykorn.org/llms.txt)
