JSON Formatter & Beautifier

Pretty print JSON with 0-8 spaces or tabs, minify it, or sort object keys recursively. Syntax errors are reported with line and column.

Free tool: 20 requests per minute.

Result

Press “Run” to see the result.

Send a JSON document in json (preferably as a string) or as a raw text/plain body, and get the formatted text back in result with its length in characters. By default the output is indented with 2 spaces; set indent to a number from 0 to 8 or to tab, or use minify=true to remove all whitespace.

With sort_keys=true the keys of every object are sorted alphabetically at all depths, which makes diffs and hashes of JSON stable. Arrays keep their order.

If the input is not valid JSON the response is valid: false with a parse_error (message, position, line and column when available) instead of an HTTP error. The request body is limited to 5 MB.

Use this in your code

curl -X POST "https://apibox.io.vn/v1/json-format" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"json":"{\"b\":2,\"a\":{\"d\":[1,2],\"c\":true}}","sort_keys":true}'

API documentation → Get a free API key

FAQ

How do I minify JSON?

Send minify=true. The result has no spaces or line breaks.

Can I indent with tabs?

Yes, set indent=tab. Numbers from 0 to 8 set the number of spaces (default 2).

What happens with invalid JSON?

The response is {"valid": false, "parse_error": {...}} with the error message and, when available, the position, line and column.