LLM
Repair malformed LLM JSON API
Fixes broken JSON an LLM emitted — strips markdown fences and prose, repairs trailing commas, single quotes, unquoted keys, Python literals (True/None), and closes truncated strings/brackets — returning valid JSON plus the parsed value and the list of fixes applied. Answers 'how do I parse this model output that isn't quite valid JSON?', 'how do I recover a truncated JSON response?'.
Price$0.05per request
MethodPOST
Route/v1/llm/json-repair
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
llmjsonrepairparsestructured-outputfixtruncatedagent
API URL
Integration docshttps://x402.hexl.dev/v1/llm/json-repairExample request
{
"text": "```json\nHere: {name: \"Bob\", age: \"30\", tags: [1,2,],}"
}Example response
{
"ok": true,
"repaired": "{\"name\": \"Bob\", \"age\": \"30\", \"tags\": [1,2]}",
"value": {
"name": "Bob",
"age": "30",
"tags": [
1,
2
]
},
"changed": true,
"fixes": [
"dropped-leading-prose",
"removed-trailing-commas",
"quoted-bare-keys"
]
}Input schema
{
"type": "object",
"required": [
"text"
],
"properties": {
"text": {
"type": "string",
"description": "The malformed/truncated JSON or LLM response to repair.",
"examples": [
"```json\nHere: {name: \"Bob\", age: \"30\", tags: [1,2,],}"
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}