# JSON Repair & Validation API

> JSON Repair & Validation API is a paid API for AI agents from api.bakhour.ca, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-14).

Takes malformed or invalid JSON text and repairs it, returning both the validated result and the repaired JSON string.

## Facts

- Endpoint: POST https://api.bakhour.ca/json/repair
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-repair-validation-api-a5c47ce8
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_bQ8jbSwufCS3Vm1Mh9gSh

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-validation-api-a5c47ce8 -d '<json body>'
```

Example prompt: Can you repair this broken JSON for me so I can parse it? It has some missing quotes and a trailing comma: {hello: 'world', foo: 'bar',}

## When to prefer this

Choose this endpoint when you have a string that is intended to be JSON but fails to parse due to syntax errors — such as unquoted keys, trailing commas, mismatched brackets, missing quotes, or LLM-generated JSON with formatting issues. It is ideal for automated pipelines that need to sanitize untrusted or programmatically generated JSON before further processing. Prefer it over manual string manipulation when the corruption is complex or the structure needs to be preserved.

## Known failure modes

- Input text is so corrupted that no JSON structure can be inferred — repair may fail or return unexpected results
- Non-JSON text passed as input may produce nonsensical repair output
- Empty or null text input may result in an error or empty response
- Ambiguous malformed JSON may be repaired in an unintended way if multiple interpretations exist

## How this service works

Decision-grade security/due-diligence outcome reports ($20-$100) plus deterministic paid utilities ($0.001+) for software agents and automated workflows.

## Output

Returns a JSON object with three fields: 'valid' (boolean indicating if the original input was valid JSON), 'parsed' (the parsed JavaScript object from the repaired JSON), and 'repaired' (a string containing the corrected, valid JSON).

## Request schema (JSON Schema)

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

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "valid": true,
  "parsed": {
   "hello": "world"
  },
  "repaired": "{\"hello\":\"world\"}"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-repair-validation-api-a5c47ce8/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.bakhour.ca](https://www.zero.xyz/host/api.bakhour.ca/llms.txt)
