What "valid JSON" actually requires
JSON is stricter than JavaScript, and most "invalid JSON" is one of five things: single quotes instead of double quotes around strings and keys; a trailing comma after the last item in an object or array; unquoted keys ({name: 1} is JavaScript, not JSON); comments, which JSON has no syntax for; and special values like NaN, Infinity or undefined, which don't exist in JSON. The validator reports the line and column of the first problem, so fix it, format again, and repeat — errors are reported one at a time because the parser stops at the first one.
Pretty print vs minify
Pretty printing adds indentation and line breaks so humans can read the structure; minifying removes every optional byte so machines transfer less. They are the same data: formatting is presentation, not content. Two-space indentation is the JavaScript ecosystem's default; four spaces are common in Python and Java projects; tabs are a matter of team style. Sorting keys alphabetically is useful for comparing two documents in a diff tool, since JSON objects are unordered and two equivalent files can list keys differently.
Big files
The formatter uses the browser's native parser, which handles files of tens of megabytes in a second or two. The limiting factor is the text box itself: past a few megabytes the page becomes sluggish to scroll. For very large files, minify first (which is fast and small) or split the file.
Privacy
Many online JSON tools send what you paste to their server — worth remembering when the JSON is an API response containing customer data or tokens. This page never does: there is no server, and you can confirm it from the browser's network tab.
Questions
Why does it say 'Unexpected token' at the very end?
Almost always a trailing comma after the last item, or the file was cut off mid-way. Remove the comma or check the file is complete.
Can I format JSON with comments (JSONC)?
Not as-is — comments aren't valid JSON. Strip them first; VS Code and most editors have a command for it.
Does sorting keys change the meaning?
No. JSON object keys are unordered by specification. Arrays are ordered and are left exactly as they were.