# 24K Labs JSON Repair

> 24K Labs JSON Repair is a paid API for AI agents from api.24klabs.ai, paid per call via x402, $0.008/call, status unknown (last checked 2026-09-14).

Fixes malformed or truncated JSON (trailing commas, unquoted keys, cut-off LLM output) into valid, parseable JSON.

## Facts

- Endpoint: POST https://api.24klabs.ai/api/v1/json-repair
- Price: $0.008/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/24k-labs-json-repair-9656dd91
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_79TwDS9XKkNEb5zIy8J_q

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 24k-labs-json-repair-9656dd91 -d '<json body>'
```

Example prompt: This JSON from my LLM pipeline is broken — it has trailing commas and an unquoted key — can you repair it so it parses correctly? Here it is: {name: "Alice", scores: [10, 20,]}

## When to prefer this

Choose this endpoint when you need to recover malformed or truncated JSON programmatically, especially when dealing with LLM-generated output that may be cut off or contain common syntax errors like trailing commas or unquoted keys. Prefer it over manual string manipulation when the JSON structure is complex or the error type is unpredictable.

## Known failure modes

- Input is so severely truncated that the intended structure cannot be inferred — returns best-effort repair or error
- Input is not JSON at all (e.g. plain text or XML) — may return an error or unrecognized format response
- Ambiguous repair cases where multiple valid completions exist — endpoint picks one heuristically, which may not match original intent
- Network or service unavailability returns a 5xx error

## How this service works

Fix malformed or truncated JSON (trailing commas, unquoted keys, cut-off LLM output) into valid, parseable JSON.

## Output

Returns a valid, parseable JSON string with all syntax errors corrected — trailing commas removed, unquoted keys properly quoted, truncated structures closed, and any other malformations resolved.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "json": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "repaired": {
   "name": "Bob"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/24k-labs-json-repair-9656dd91/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.24klabs.ai](https://www.zero.xyz/host/api.24klabs.ai/llms.txt)
