JSON Formatter API
Our JSON Formatter API allows you to integrate our formatting and validation capabilities directly into your applications. Below you'll find documentation for our API endpoints.
Base URL
https://api.ti2o.fun/json
Authentication
All API requests require an API key sent in the X-API-Key header.
Endpoints
POST /format
Formats and beautifies JSON input with proper indentation.
Request
{
"json": "{\"name\":\"John\",\"age\":30}",
"indent": 4 // Optional, default is 2
}
Response
{
"success": true,
"formatted": "{\n \"name\": \"John\",\n \"age\": 30\n}",
"valid": true
}
POST /validate
Validates JSON input and returns any errors found.
Request
{
"json": "{\"name\":\"John\",\"age\":30,}"
}
Response
{
"success": false,
"valid": false,
"error": "Unexpected token } in JSON at position 25",
"position": 25
}
POST /fix
Attempts to automatically fix common JSON errors.
Request
{
"json": "{\"name\":\"John\",\"age\":30,}"
}
Response
{
"success": true,
"fixed": "{\"name\":\"John\",\"age\":30}",
"changes": ["Removed trailing comma"]
}
API Rate Limits
Free tier: 100 requests/day. For higher limits, please contact contact@ti2o.fun.