# AgentFund Structured JSON Repair

> AgentFund Structured JSON Repair is a paid API for AI agents from x402.agentfund.net, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-15).

Repairs malformed or invalid JSON text, optionally validating and coercing types against a provided JSON Schema

## Facts

- Endpoint: POST https://x402.agentfund.net/x402/structured_json_repair
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agentfund-structured-json-repair-34d75ed2
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_gJ0FY4WuEkl_PaptWVl5n

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 agentfund-structured-json-repair-34d75ed2 -d '<json body>'
```

Example prompt: This JSON string I got back from a model output is broken — can you repair it and coerce the types to match this schema: {"type":"object","properties":{"price":{"type":"number"},"active":{"type":"boolean"}}}? Here's the malformed input: '{price: "12.5", active: "true"}'

## When to prefer this

Choose this endpoint when you have broken, malformed, or syntactically invalid JSON that needs to be repaired before use — especially useful for cleaning LLM outputs, scraped data, or hand-written JSON with common mistakes like unquoted keys, trailing commas, or wrong-typed values. Particularly valuable when you also need schema-based type coercion in a single call. Prefer this over custom parsing logic when you need a reliable, paid-guarantee repair service in an agent pipeline.

## Known failure modes

- Input is so malformed it cannot be meaningfully repaired (returns error)
- Schema mismatch where coercion is impossible (e.g. a non-numeric string to number)
- Empty or null input string
- Schema itself is invalid JSON Schema
- Payment failure via x402 protocol before processing begins

## How this service works

Structured JSON Repair

## Output

A structured JSON response containing the repaired, valid JSON object. If a schema was provided, the output is also validated and type-coerced to conform to that schema. Returns clean, parseable JSON ready for downstream processing.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "input": {
   "type": "string",
   "description": "Raw/malformed JSON text to repair."
  },
  "coerce": {
   "type": "boolean",
   "description": "Coerce types to fit the schema (default true)."
  },
  "schema": {
   "type": "object",
   "description": "Optional JSON Schema to validate/coerce against."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "data": {
   "age": 36,
   "name": "Ada"
  },
  "errors": [],
  "changed": true,
  "repairs": []
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agentfund-structured-json-repair-34d75ed2/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.agentfund.net](https://www.zero.xyz/host/x402.agentfund.net/llms.txt)
