Best Free JSON Formatter & Validator
Beautify, minify and validate JSON with clear error messages — free, nothing stored.
How it works
- Paste JSON. Drop your JSON into the box.
- Choose an action. Beautify with 2 or 4 spaces, or minify to one line; optionally sort keys.
- Get the result. Valid JSON is formatted instantly; invalid JSON returns the exact line and column of the error.
About this tool
Paste JSON to pretty-print it with the indentation you choose, minify it down to a single line, or just check that it's valid. If parsing fails you get a clear message with the line and column of the problem, so you can find the stray comma or missing brace fast. You can also sort object keys alphabetically. It runs server-side with Python's JSON parser, stores nothing, and needs no account.
What people use it for
- Make a minified API response readable
- Find the line and column of a JSON syntax error
- Minify JSON before pasting it into a config
- Sort object keys to diff two JSON files
Developer API
Automate this tool from your own code. Send a POST request to the endpoint below and get the same result the web tool produces. It is rate-limited per IP and needs no signup — API keys for higher limits are coming.
https://best.free/api/tools/json-formatter/
| Parameter | Example | Required | Notes |
|---|---|---|---|
text |
{"b":2,"a":1} |
Yes | Raw JSON to format. |
action |
format |
No | "format" or "minify". |
indent |
2 |
No | 0–8 spaces. |
sort |
True |
No | Sort keys. |
curl -X POST https://best.free/api/tools/json-formatter/ \
-H 'Content-Type: application/json' \
-d '{"text": "{\"b\":2,\"a\":1}", "action": "format", "indent": 2, "sort": true}'
import requests
r = requests.post(
"https://best.free/api/tools/json-formatter/",
json={"text": "{\"b\":2,\"a\":1}", "action": "format", "indent": 2, "sort": True},
)
print(r.json())
const r = await fetch("https://best.free/api/tools/json-formatter/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: "{\"b\":2,\"a\":1}", action: "format", indent: 2, sort: true }),
});
const data = await r.json();
console.log(data);
Response: JSON with the formatted string + validity.
{"ok": true, "json": "{\n \"a\": 1,\n \"b\": 2\n}", "json_valid": true}