# Animica JSON Repair API

> Animica JSON Repair API is a paid API for AI agents from animica.dev, paid per call via x402, $0.001794/call, status unknown (last checked 2026-09-15).

Repairs malformed, fenced, or prose-wrapped JSON strings and validates them against a provided JSON Schema

## Facts

- Endpoint: POST https://animica.dev/x402/json/repair
- Price: $0.001794/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/animica-json-repair-api-bdbabe69
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_9MK46H5na5Wll8XNKi3yz

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 animica-json-repair-api-bdbabe69 -d '<json body>'
```

Example prompt: This JSON from the LLM response has markdown fences and is missing a closing bracket — can you repair it and make sure it matches this schema: {"type":"object","required":["name","age"]}? Here's the broken JSON: ```{"name": "Alice", "age": 30```

## When to prefer this

Use this endpoint when you need to programmatically fix malformed JSON — especially output from LLMs that wraps JSON in markdown fences, prose, or contains syntax errors — and you need the result validated against a specific JSON Schema. It is particularly valuable in agentic pipelines where LLM outputs must be reliably parsed. Prefer this over manual regex-based parsing or custom repair logic when schema conformance is required and robustness matters.

## Known failure modes

- Input JSON is so malformed that even model-based repair cannot produce schema-conformant output
- Provided JSON Schema is invalid or unsatisfiable, causing all repair attempts to fail
- Input string contains no JSON-like content at all
- Schema constraints are too strict and the repaired JSON cannot satisfy them within allowed attempts
- Network timeout or service error during model-based repair step

## How this service works

Hand over malformed model output and a JSON Schema; get back JSON that provably satisfies it. Tries a pure-parse fast path FIRST and returns immediately when the input is already valid — you are not charged a model call for text that merely looked broken. Otherwise a small model repairs it and the result is validated in code before it is returned. Priced per call. For high-volume use, buy prepaid credits (POST /x402/credits/buy) and send X-Animica-Credits on each request — no settlement, no gas, no per-call payment round trip. Paying in ANM on the animica:1 lane is also ~25% cheaper because we sponsor no gas there.

## Output

Returns a JSON object containing: `data` (the repaired and schema-validated JSON value), `method` (either 'parsed' if fixed syntactically or 'model_repaired' if an AI model was used), `model` (the model used if any), and `attempts` (number of repair attempts made).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "input": {
   "type": "string",
   "description": "the malformed / fenced / prose-wrapped JSON"
  },
  "schema": {
   "type": "object",
   "description": "JSON Schema the repaired value must satisfy"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

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