# apiacre.com JSON Repair

> apiacre.com JSON Repair is a paid API for AI agents from apiacre.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-13).

Repairs malformed JSON by removing Markdown fences, comments, single-quoted strings, unquoted keys, Python literals, and trailing commas, with strict duplicate key and non-finite number rejection

## Facts

- Endpoint: POST https://apiacre.com/v1/data/json-repair
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/apiacre-com-json-repair-b5971efc
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_60EwKESJIE56K5wrC_47v

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 apiacre-com-json-repair-b5971efc -d '<json body>'
```

Example prompt: I've got some broken JSON from an LLM response — it has a Markdown code fence around it, trailing commas, and single-quoted strings. Can you repair it into valid JSON and give me the cleaned-up result?

## When to prefer this

Use this endpoint when you receive JSON from an LLM, user input, or a loosely-conformant API that has common syntax issues like Markdown fences, comments, trailing commas, single-quoted strings, unquoted keys, or Python literals. Prefer it over generic JSON parsers when you need deterministic transformation hashes for auditing, strict duplicate key rejection, and safe handling of Python-dialect JSON without writing custom cleanup code.

## Known failure modes

- Input contains duplicate keys — endpoint returns a strict rejection error rather than silently resolving
- Non-finite numbers (Infinity, NaN) trigger rejection rather than repair
- Input is so severely malformed that no recovery heuristic applies — returns parse failure
- Payload too large may result in a timeout or size error
- Non-JSON content types (e.g. raw binary) cannot be repaired

## How this service works

Repair caller-supplied malformed JSON by safely removing an outer Markdown fence, comments, single-quoted strings, unquoted identifier keys, Python literals, and trailing commas, with transformation hashes and strict rejection of duplicate keys or non-finite numbers.

## Output

Returns a valid, strictly-conformant JSON document with all recoverable syntax errors fixed, plus a transformation hash describing what was changed. Rejects input that contains duplicate keys or non-finite numbers (e.g. Infinity, NaN) with a clear error.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "content": {
   "type": "string"
  },
  "repairs": {
   "type": "array",
   "items": {
    "enum": [
     "markdown_fence",
     "comments",
     "single_quoted_strings",
     "unquoted_keys",
     "python_literals",
     "trailing_commas"
    ],
    "type": "string"
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "data": {
   "error": null,
   "valid": true,
   "repair": {
    "version": "apiacre-json-repair/1",
    "permitted": [
     "markdown_fence",
     "comments",
     "single_quoted_strings",
     "unquoted_keys",
     "python_literals",
     "trailing_commas"
    ],
    "executionOrder": [
     "markdown_fence",
     "comments",
     "single_quoted_strings",
     "unquoted_keys",
     "python_literals",
     "trailing_commas"
    ],
    "appliedStrategyCount": 6,
    "outputCanonicalization": "json-sort-keys-indent-2-utf8"
   },
   "content": "{\n  \"active\": true,\n  \"rows\": [\n    1,\n    2,\n    3\n  ],\n  \"status\": \"ok\"\n}",
   "repaired": true,
   "warnings": [],
   "validInput": false,
   "inputSha256": "9dd0095fe6576143aa8e835ced506030e8065e2589c4478a4be1342dc1aaa2ed",
   "outputSha256": "b1b2333ad8949036facfd8ce006b4da0e612468a0e8a9b016514208af13321d5",
   "attemptSha256": "4db25e6c34e4f507a7b3addba28d9c40bda76572ef52c9a7b49facdea7f19440",
   "appliedRepairs": [
    {
     "strategy": "markdown_fence",
     "afterSha256": "e47f9ab1e0ee78db083237290fcdd35f83668f2b939c92e434b2103af7856f4f",
     "occurrences": 1,
     "beforeSha256": "9dd0095fe6576143aa8e835ced506030e8065e2589c4478a4be1342dc1aaa2ed"
    }
   ]
  },
  "meta": {
   "cached": false,
   "sources": [],
   "warnings": [],
   "duration_ms": 42,
   "next_actions": [
    {
     "path": "/v1/data/schema",
     "title": "JSON Schema generator",
     "method": "POST",
     "reason": "Infer a reusable Draft 2020-12 contract from the successfully repaired JSON.",
     "service": "data.schema"
    }
   ]
  },
  "service": "data.json-repair",
  "version": "1",
  "request_id": "018f1f54-7f38-7ba2-8dc3-5f90272d9f1a"
 }
}
```

## More

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