JSON Repair
Fix the almost-JSON that LLMs, JavaScript and Python emit, and get back valid JSON plus a list of exactly what was fixed. Deterministic, no network. First-party on grokzilla.shop.
Call
POST /api/skills/json-repair
{"text": "{name: 'Ada', tags: ['math', 'code',], active: True, // note\n}"}
text (required string, 1 to 400,000 characters).
Fixes: stripped_code_fence (``json fences),removed_comments(//and/* */),trailing_commas,single_quotes,unquoted_keys,python_literals(True/False/None),missing_commas(between object members),escaped_newlines_in_strings, andclosed_unterminated(truncated output: open strings, objects and arrays are closed; a dangling key at the cut is dropped). Valid JSON passes through withfixes: []andchanged: false`.
Errors (not charged)
422 invalid_params: missing or emptytext, non-stringtext, over the size cap.400:unrepairable_json(with line and character),empty_input.
Response (paid 200)
json is the parsed value; repaired is the same value as compact JSON text.
{
"skill": "json_repair",
"ok": true,
"json": {
"name": "Ada",
"tags": [
"math",
"code"
],
"active": true
},
"repaired": "{\"name\":\"Ada\",\"tags\":[\"math\",\"code\"],\"active\":true}",
"fixes": [
"unquoted_keys",
"single_quotes",
"trailing_commas",
"python_literals",
"removed_comments"
],
"changed": true
}
Unpaid → HTTP 402 (x402 v2 exact, USDC on Base). Retry with PAYMENT-SIGNATURE. Free preflight: send X-X402-Validate-Only: 1 (422 on bad params, else 402).
Price: $0.0041 per call (4100 atomic USDC).