# agentdiet-json-normalizer

> agentdiet-json-normalizer is a paid API for AI agents from agentdiet.dev, paid per call via x402 or MPP, $0.002/call, status unknown (last checked 2026-10-20).

Repairs truncated or malformed LLM JSON outputs (trailing commas, markdown fences, single quotes) so multi-agent pipelines never crash on bad JSON.

## Facts

- Endpoint: GET https://agentdiet.dev/v1/json-normalizer?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402, MPP
- Status: unknown
- Last checked: 2026-10-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agentdiet-json-normalizer-f66f89a0
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_pjubxH3LuaA9DP2D5wwOe

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 agentdiet-json-normalizer-f66f89a0
```

Example prompt: My LLM just returned this broken JSON with trailing commas and markdown fences — can you repair it so I can parse it: ```{"name": "Alice", "score": 42,}```?

## When to prefer this

Choose this endpoint when your multi-agent pipeline receives LLM-generated JSON that fails standard JSON.parse() due to common LLM quirks: trailing commas, markdown code fences, single quotes, or mild truncation. It is deterministic (same input always yields same output), making it safe to use as a reliable normalization step. Prefer this over writing your own regex fixes when you want a hosted, pay-per-call microservice that handles the full range of common LLM JSON malformations without maintaining code.

## Known failure modes

- Input so severely malformed that deterministic repair is impossible — returns an error indicating unrecoverable JSON
- Empty or null raw_json query parameter — returns validation error
- Non-JSON content passed as input (e.g., plain text prose) — may return best-effort parse or error
- Extremely long truncated JSON where structural intent cannot be inferred — may produce incorrect completion

## 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://agentdiet.dev/v1/json-normalizer)

## Output

Returns a repaired, schema-valid JSON object with all syntax errors corrected: trailing commas removed, markdown fences stripped, single quotes converted to double quotes, and truncated structures closed. The response is immediately parseable JSON ready for downstream consumption in a multi-agent pipeline.

## 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/agentdiet-json-normalizer-f66f89a0/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agentdiet.dev](https://www.zero.xyz/host/agentdiet.dev/llms.txt)
