API Documentation

Integrate JSON formatting into your applications with our REST API.

POST/api/json/beautify

Format JSON with proper indentation

Request Body:

{
  "json": "{\"name\":\"John\",\"age\":30}",
  "indent": 2
}

Response:

{
  "result": "{\n  \"name\": \"John\",\n  \"age\": 30\n}"
}
POST/api/json/compress

Minify JSON by removing whitespace

Request Body:

{
  "json": "{\n  \"name\": \"John\",\n  \"age\": 30\n}"
}

Response:

{
  "result": "{\"name\":\"John\",\"age\":30}"
}
POST/api/json/fix

Fix malformed JSON with AI

Request Body:

{
  "json": "{name: \"John\", age: 30,}"
}

Response:

{
  "result": "{\n  \"name\": \"John\",\n  \"age\": 30\n}",
  "method": "llm"
}

Example Usage

curl -X POST https://jsonformatter.freeai.help/api/json/beautify \
  -H "Content-Type: application/json" \
  -d '{"json": "{\"name\":\"John\"}"}'