JSON Formatter & Validator

Beautify, minify and validate JSON with clear error messages — free, nothing stored.

100% free No signup No watermark Processed in memory, never stored

How it works

  1. Paste JSON. Drop your JSON into the box.
  2. Choose an action. Beautify with 2 or 4 spaces, or minify to one line; optionally sort keys.
  3. 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.

POST 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}

Frequently asked questions

It can beautify (pretty-print) JSON with your chosen indentation, minify it to a single line, validate it, and optionally sort object keys alphabetically.

You get a clear error message including the exact line and column where parsing failed, so you can locate a missing brace or stray comma quickly.

Yes — beautify with 2 or 4 spaces, or minify to remove all whitespace for the smallest output.

Up to about 500,000 characters in one go.

No. It is parsed with Python’s standard JSON library for your request only and is never stored, logged or forwarded.

No. Sorting only reorders object keys alphabetically for readability and diffing; the values and structure are unchanged.

No signup or payment — it is free with a fair hourly limit per IP.

Yes. POST a JSON body to /api/tools/json-formatter/ and you get a JSON response back — the same engine the web tool uses, so results are identical. It is rate-limited per IP like the web version and needs no signup; API keys for higher limits are coming. See the API section above for ready-to-run curl, Python and JavaScript examples.