How it works
The page reads your text with a strict JSON parser that follows RFC 8259, the JSON standard. It stops at the first character that cannot be JSON and reports where it is and why: a trailing comma, a single quote, a missing colon or comma, a comment, a number JSON does not allow.
Valid JSON is written back with the indentation you picked, or with every optional space removed when you minify it. Numbers and strings are copied exactly as you wrote them, so a long ID such as 12345678901234567890 keeps every digit and an escape like \u00e9 stays as it is. Sorting orders the keys of every object by their characters' code points; keys that appear twice keep both copies, in order.
Everything runs in your browser. Files up to a few megabytes format in a moment; above 1 MB the page waits for you to press Format instead of reformatting on every key.
Example
This input has a trailing comma after the last item:
{
"name": "web-1",
"ports": [80, 443,]
}The validator stops at line 3, column 20, on that comma, and says JSON allows no comma after the last item. Remove it and the text formats as shown, or minifies to one line of 33 characters.
{
"name": "web-1",
"ports": [
80,
443
]
}Questions
Why does my JSON fail on a trailing comma?
Because JSON allows a comma only between two items. JavaScript, Python and many config formats accept a comma after the last item of a list or object; JSON does not, and strict parsers such as JSON.parse, jq and most APIs reject the whole document. Remove the comma that the error points at.
Can JSON have comments?
No. JSON has no comment syntax. Some programs read JSONC or JSON5 instead, which allow comments (VS Code settings and tsconfig.json are JSONC), but a strict JSON parser rejects them. Delete the comments, or keep a note in an ordinary field such as "_comment".
Does formatting change my numbers?
Not here. JavaScript's JSON.parse turns every number into a 64-bit floating-point value, so 12345678901234567890 comes back as 12345678901234567000 and 1.10 as 1.1. This formatter never converts them: numbers, strings and escapes are written back exactly as they were. Only the spaces and line breaks between them change.
What is the difference between formatting and minifying?
Formatting adds line breaks and indentation so a person can read the structure. Minifying removes every space and line break that JSON does not need, which makes the file smaller to store and send. Both hold exactly the same data; a program reads them the same way.
Is the JSON I paste sent anywhere?
No. It is parsed and formatted by this page's script in your browser and never leaves your device, so it is safe for configs and API responses that hold keys or personal data. Once the page has loaded it works offline.