# Deterministic LLM JSON Repair & Schema Validator

> Deterministic LLM JSON Repair & Schema Validator is a paid API for AI agents from llms-generator.agentdiet.dev, paid per call via MPP, $0.002/call, status unknown (last checked 2026-10-21).

Deterministically repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines can safely parse them.

## Facts

- Endpoint: GET https://llms-generator.agentdiet.dev/v1/json-fix?utm_source=zero.xyz
- Price: $0.002/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Provider: llms-generator.agentdiet.dev
- Website: https://llms-generator.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/llms-generator-agentdiet-dev-deterministic-llm-json-repair-schema-3d7295d1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_lX6m1l4EMpzAOsC3Qy72M

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 llms-generator-agentdiet-dev-deterministic-llm-json-repair-schema-3d7295d1
```

Example prompt: The JSON I got back from the LLM has trailing commas and is wrapped in markdown fences — can you fix it so it's valid JSON I can actually parse? Here's the raw output: ```{"name": "Alice", "age": 30,}```

## When to prefer this

Choose this endpoint when your multi-agent or LLM pipeline receives JSON output that fails standard parsing due to common LLM formatting errors like trailing commas, markdown fences, single quotes, or truncation. Prefer this over writing custom regex logic or retrying the LLM call, as it is deterministic, fast, and low-cost ($0.002/call).

## Known failure modes

- Input JSON is so severely malformed it cannot be deterministically repaired, returning an error
- Input string is not JSON-like at all (e.g. plain text), causing repair failure
- Truncation is too severe to infer correct closing structure
- raw_json parameter missing or empty, returning 400-level error

## How this service works

Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines never crash. (Live x402 v2, IETF MPP & MCP endpoint at https://llms-generator.agentdiet.dev/v1/json-fix)

## Output

A repaired, valid JSON object with all syntax errors corrected — trailing commas removed, markdown fences stripped, single quotes normalized to double quotes, and truncated structures closed — ready for downstream parsing in agent pipelines.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "raw_json"
 ],
 "properties": {
  "raw_json": {
   "type": "string",
   "minLength": 1,
   "description": "Malformed, truncated, or markdown-wrapped JSON string to deterministically repair"
  }
 }
}
```

## Response schema (JSON Schema)

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

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/llms-generator-agentdiet-dev-deterministic-llm-json-repair-schema-3d7295d1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from llms-generator.agentdiet.dev](https://www.zero.xyz/host/llms-generator.agentdiet.dev/llms.txt)
