API Acre · Data Json Repair

by API Acre

POSTBaseSolana

$0.005

per call · USD Coin on Base

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.

Endpoint

POST https://apiacre.com/v1/data/json-repair

3

Calls / 30d

2

Unique payers / 30d

Aug 31

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://apiacre.com/v1/data/json-repair", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "content": "```json\n{\n  // generated result\n  status: 'ok',\n  rows: [1, 2, 3,],\n  active:...",
    "repairs": [
      "markdown_fence",
      "comments",
      "single_quoted_strings",
      "unquoted_keys",
      "python_literals",
      "trailing_commas"
    ]
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://apiacre.com/v1/data/json-repair" \
  -H "Content-Type: application/json" \
  -d '{"content":"```json\n{\n  // generated result\n  status: 'ok',\n  rows: [1, 2, 3,],\n  active:...","repairs":["markdown_fence","comments","single_quoted_strings","unquoted_keys","python_literals","trailing_commas"]}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

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

Payment details

Pay to0xa0bfa4f07281c9b248dc3aed2217836bca24869b
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase, Solana
Schemesexact

Is this your API?

Pin it to the top of Data & Enrichment and the homepage with a featured placement.

Get featured →

More from API Acre & similar services