Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

JSON Formatter API

Validate and pretty-print or minify JSON.

POST /api/v1/tools/json-formatterMCP json_formatterDeveloper Tools

Format, beautify, minify and validate JSON in your browser. Pinpoints syntax errors by line and column, and can sort keys. Your data never leaves your device.

Input

Send these as a JSON object. Unknown fields are rejected.

input
The JSON text. (string, required)
mode
format or minify. (string, one of format, minify, default "format")
indent
Spaces per level when formatting: 2 or 4. (integer, 2 to 4, default 2)
sortKeys
Sort object keys alphabetically. (boolean, default false)
curl https://pithlab.com/api/v1/tools/json-formatter \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"input":"{\"b\":1,\"a\":[true,null]}","sortKeys":true}'
Example response
{
  "ok": true,
  "result": {
    "output": "{\n  \"a\": [\n    true,\n    null\n  ],\n  \"b\": 1\n}"
  }
}