Common questions about formatting, validating and the strict rules JSON enforces.
How do I format JSON?
Paste your JSON into the left editor. With auto format on it is indented immediately; otherwise press Beautify or ⌘/Ctrl+Enter. Pick your indentation, 2, 3 or 4 spaces, or tabs, then copy the result or download it as a file.
Is my JSON uploaded to a server?
No. This page has no backend. The formatter is JavaScript that runs in your browser, so your JSON never leaves the tab. You can verify it by opening DevTools, switching to the Network tab, and formatting a document, no request is made.
What is the difference between beautifying and minifying JSON?
Both keep the data identical and only change whitespace. Beautifying adds newlines and indentation so a human can read the structure. Minifying removes all optional whitespace to make the payload as small as possible, which suits anything that gets transmitted or embedded in code.
Why is my JSON invalid when it looks like valid JavaScript?
JSON is much stricter than JavaScript object syntax. It forbids trailing commas, requires double quotes around both keys and string values, disallows comments, and rejects single quotes, unquoted keys, undefined, NaN and Infinity. A JavaScript object literal that works fine in code is frequently invalid JSON.
Can I use comments in a JSON file?
Not in standard JSON. The specification has no comment syntax, so this validator rejects them. Some tools accept a superset called JSONC (used by tsconfig.json and VS Code settings) which does allow // and /* */. If you need comments, keep the file as JSONC and strip them before handing it to a strict parser.
Can this tool fix invalid JSON automatically?
This page reports errors rather than guessing at repairs, because a wrong guess silently changes your data. For automatic repair of the common cases, trailing commas, unquoted keys, smart quotes, use the JSON Fixer, then bring the result back here to format it.
How large a JSON file can I format?
There is no limit set by us. The constraint is your device's memory, since the whole document is held in RAM. Files in the low tens of megabytes are fine on a laptop; format-as-you-type switches off above 512 KB so typing stays responsive, and you press Beautify instead.
Does it work offline?
Yes, once the page has loaded. The formatter is already on your machine at that point, so you can disconnect and keep working. Reloading while offline depends on the page still being in your browser cache.
Will formatting change my data?
Formatting only alters whitespace, so the parsed value is identical. There are two things worth knowing, though: very large integers and duplicate keys are affected by the parse step itself, see the next two answers.
Why did my very large numbers change?
JSON.parse produces JavaScript numbers, which are IEEE-754 doubles and can only represent integers exactly up to 9,007,199,254,740,991. An ID like 12345678901234567890 loses precision on the way in, and the formatted output will show the rounded value. If you handle large integers such as Twitter-style snowflake IDs or int64 database keys, transport them as strings.
What happens to duplicate keys?
JSON technically permits repeated keys but does not define what they mean. JavaScript keeps the last one, so {"a":1,"a":2} formats to {"a": 2} and the first value is silently dropped. If a document surprises you by losing a field, duplicate keys are worth checking for.
Does sorting keys change the meaning of my JSON?
No. Object key order is not significant in JSON, so sorting is safe and makes two versions of a config genuinely diffable. Array order is significant and is never touched. One caveat: JavaScript engines always place integer-like keys such as "2" and "10" first, in numeric order, regardless of sorting.
Can I format JSON Lines or NDJSON?
Not directly. JSON Lines files contain one independent JSON document per line, so the file as a whole is not valid JSON and will fail validation. Format one line at a time, or wrap the lines in an array with commas between them first.
What keyboard shortcuts are available?
⌘/Ctrl+Enter beautifies, ⌘/Ctrl+Shift+M minifies, ⌘/Ctrl+Shift+C copies the output and ⌘/Ctrl+S downloads it. Tab inserts two spaces inside the editor; Shift+Tab still moves focus out, so you are never trapped in the field.
Do I need an account?
No. There is no sign-up, no email and no usage limit. Nothing about your session is stored beyond the tab you have open.
Is my text uploaded to a server?
No. JSON Formatter is a static page with no backend. Your text is read and processed by JavaScript running in this tab, and it is never transmitted. You can confirm this by opening your browser's network panel while you use the tool. There are no outbound requests.
How much data can I paste in?
There is no server-side cap. Very large inputs are limited only by your device's memory and will make the page feel slower, since the work happens on the main thread. In practice a few megabytes of text is comfortable.
Do I need to create an account?
No. There is no sign-up, no email, and no usage tracking tied to an identity. The tool works the first time you open it.