JSON formatter and validator

Pretty-print, validate, minify and sort JSON in your browser. Errors show the line and column. Nothing is uploaded.

Valid JSON

How it works

Paste JSON to check it is valid and make it readable. Formatting adds indentation and line breaks; minifying removes all of them to make payloads smaller; sorting keys makes two documents easy to compare.

When the JSON is invalid, the error shows where parsing stopped. The usual causes are trailing commas, single quotes instead of double quotes, and unquoted keys.

Questions

Does it accept comments or trailing commas?
No. Standard JSON allows neither, so this validator reports them as errors, as most APIs would.
Is there a size limit?
Only your browser's memory. Several megabytes format instantly.

Do this in your code

The same job is one call to the APIStack API, from any language or as a tool for AI agents over MCP. The free plan includes it.

curl -X POST https://apistack.online/api/utilities/json-formatter/v1 \
  -H "x-api-key: $APISTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"json":"{\"name\":\"John\",\"age\":30}","indent":2,"sortKeys":true,"operation":"format"}'

Related