Introduction
Welcome to the JSON Repair API documentation. Our service provides a high-concurrency, sub-millisecond API for repairing malformed JSON and validating it against custom schemas.
Ultra Fast
Built with Elixir/Phoenix for maximum performance and low latency.
Secure
Industry-standard SHA256 hashing for API keys and secure authentication.
Authentication
All API requests must be authenticated using an API key. You can generate keys in your Dashboard.
We support two methods of passing the API key:
Authorization: Bearer YOUR_API_KEY
x-api-key: YOUR_API_KEY
POST /api/repair
The primary endpoint for repairing and validating JSON payloads.
Request Body
| Property | Type | Description |
|---|---|---|
| json | string | The malformed JSON string you wish to repair. |
| schema | object | Optional. A valid JSON Schema to validate the repaired JSON against. |
| debug | boolean | Optional. If true, the response will include the original input string. |
Code Examples
cURL
curl -X POST https://api.jsonrepair.com/api/repair \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"json": "{\"foo\": \"bar\",}"}'JavaScript (Fetch)
const response = await fetch('https://api.jsonrepair.com/api/repair', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
json: '{"foo": "bar",}'
})
});
const data = await response.json();
console.log(data);Python
import requests
url = "https://api.jsonrepair.com/api/repair"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"json": '{"foo": "bar",}'
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Response Format
{
"valid": true,
"repaired": true,
"json": {
"foo": "bar"
},
"text": "{\"foo\": \"bar\"}",
"original": "{\"foo\": \"bar\",}" // Only if debug: true
}