Repair malformed JSON and enforce its contract
$0.04 USDC maxApply only explicit deterministic syntax repairs to caller-supplied JSON, infer a Draft 2020-12 schema from the valid result, then validate a future JSON value.
Inspect the 3-step recipeRepair 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.
https://apiacre.com/v1/data/json-repairSend the JSON body below. An unpaid request returns HTTP 402 with a PAYMENT-REQUIRED header; an x402-compatible buyer signs the requirement and retries with PAYMENT-SIGNATURE.
Coinbase Agentic Wallet can satisfy this x402 request in one command. Running it may pay automatically, so --max-amount is fixed to $0.005 USDC in atomic units. Copying the command does not install, authenticate, sign, or pay; review the request and use a separate low-value wallet before running it.
npx --yes awal@latest x402 pay https://apiacre.com/v1/data/json-repair \
-X POST \
-d '{"content":"```json\n{\n // generated result\n status: '"'"'ok'"'"',\n rows: [1, 2, 3,],\n active: True,\n}\n```","repairs":["markdown_fence","comments","single_quoted_strings","unquoted_keys","python_literals","trailing_commas"]}' \
--max-amount 5000 \
--jsonCoinbase pay-for-service documentation · Buyer setup and wallet safety
Run check first without payment. Its fetch command may automatically pay up to the exact listed price.
npx --yes agentcash@latest check https://apiacre.com/v1/data/json-repair
npx --yes agentcash@latest fetch https://apiacre.com/v1/data/json-repair \
--method POST \
--header 'content-type: application/json' \
--body '{"content":"```json\n{\n // generated result\n status: '"'"'ok'"'"',\n rows: [1, 2, 3,],\n active: True,\n}\n```","repairs":["markdown_fence","comments","single_quoted_strings","unquoted_keys","python_literals","trailing_commas"]}' \
--payment-protocol x402 \
--payment-network base \
--max-amount 0.005{
"content": "```json\n{\n // generated result\n status: 'ok',\n rows: [1, 2, 3,],\n active: True,\n}\n```",
"repairs": [
"markdown_fence",
"comments",
"single_quoted_strings",
"unquoted_keys",
"python_literals",
"trailing_commas"
]
}{
"request_id": "018f1f54-7f38-7ba2-8dc3-5f90272d9f1a",
"service": "data.json-repair",
"version": "1",
"data": {
"valid": true,
"validInput": false,
"repaired": true,
"content": "{\n \"active\": true,\n \"rows\": [\n 1,\n 2,\n 3\n ],\n \"status\": \"ok\"\n}",
"inputSha256": "9dd0095fe6576143aa8e835ced506030e8065e2589c4478a4be1342dc1aaa2ed",
"attemptSha256": "4db25e6c34e4f507a7b3addba28d9c40bda76572ef52c9a7b49facdea7f19440",
"outputSha256": "b1b2333ad8949036facfd8ce006b4da0e612468a0e8a9b016514208af13321d5",
"appliedRepairs": [
{
"strategy": "markdown_fence",
"occurrences": 1,
"beforeSha256": "9dd0095fe6576143aa8e835ced506030e8065e2589c4478a4be1342dc1aaa2ed",
"afterSha256": "e47f9ab1e0ee78db083237290fcdd35f83668f2b939c92e434b2103af7856f4f"
},
{
"strategy": "comments",
"occurrences": 1,
"beforeSha256": "e47f9ab1e0ee78db083237290fcdd35f83668f2b939c92e434b2103af7856f4f",
"afterSha256": "32c07c381a864b84081a14113c51362f1bd433d11508384527398201c6297f13"
},
{
"strategy": "single_quoted_strings",
"occurrences": 1,
"beforeSha256": "32c07c381a864b84081a14113c51362f1bd433d11508384527398201c6297f13",
"afterSha256": "342754701e195410b00be4982ce0f253988027a4d8aaeefcc6919f0322e75d0c"
},
{
"strategy": "unquoted_keys",
"occurrences": 3,
"beforeSha256": "342754701e195410b00be4982ce0f253988027a4d8aaeefcc6919f0322e75d0c",
"afterSha256": "59847350008ddd4fc3961827f32dff57a40e71cd232b55e1791d75fa3f677256"
},
{
"strategy": "python_literals",
"occurrences": 1,
"beforeSha256": "59847350008ddd4fc3961827f32dff57a40e71cd232b55e1791d75fa3f677256",
"afterSha256": "01ee6bffd9608824b7e78f21446bf858c5b64bfcd60ad539b1dd5879af7f3121"
},
{
"strategy": "trailing_commas",
"occurrences": 2,
"beforeSha256": "01ee6bffd9608824b7e78f21446bf858c5b64bfcd60ad539b1dd5879af7f3121",
"afterSha256": "4db25e6c34e4f507a7b3addba28d9c40bda76572ef52c9a7b49facdea7f19440"
}
],
"error": null,
"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",
"duplicateKeysAllowed": false,
"nonFiniteNumbersAllowed": false,
"deterministic": true,
"networkRequestsMade": 0
},
"warnings": []
},
"meta": {
"duration_ms": 42,
"cached": false,
"sources": [],
"warnings": [],
"next_actions": [
{
"service": "data.schema",
"title": "Schema inference",
"reason": "Infer a reusable Draft 2020-12 contract from the successfully repaired JSON.",
"method": "POST",
"path": "/v1/data/schema",
"price": "$0.025",
"input_template": {
"content": "$result.data.content",
"format": "json",
"root_mode": "preserve"
},
"use_output": "Continue only when result.data.valid is true; persist the schema together with the repair input and output hashes.",
"authorization_required": true
}
]
}
}These buyer-controlled recipes connect this service to compatible API Acre results. Every step has its own exact price and requires separate authorization.
Apply only explicit deterministic syntax repairs to caller-supplied JSON, infer a Draft 2020-12 schema from the valid result, then validate a future JSON value.
Inspect the 3-step recipeThese optional follow-ups use this result in a larger workflow. Each call shows a fresh x402 challenge and requires separate buyer authorization.
Infer a reusable Draft 2020-12 contract from the successfully repaired JSON.
Review and run this separate callcurl -i -X POST 'https://apiacre.com/v1/data/json-repair' \
-H 'content-type: application/json' \
--data '{"content":"```json\n{\n // generated result\n status: 'ok',\n rows: [1, 2, 3,],\n active: True,\n}\n```","repairs":["markdown_fence","comments","single_quoted_strings","unquoted_keys","python_literals","trailing_commas"]}'