JSON Formatter
What you get
It tells you the line and the column
"Unexpected token", with nothing about where, is the least useful error message in common use. This page reads the document itself, gives the line and the column it broke at, and prints that line back with a mark under the character in question.
Both forms at once
You get the indented version and the one-line version together — the second is the one you paste back into a config file.
Your numbers come back exactly as you wrote them
Many tools of this kind read the document into values and write it out again, so a very long whole number quietly loses its last digits. Here the values are copied character for character; only the spacing and the line breaks change.
Nothing is stored
Your JSON never goes into the page address, so it does not land in your browsing history, in a Referer header, or in a proxy log along the way. It is checked and thrown away.
How it works
- Paste your JSON into the box.
- Press Format.
- Get the indented form and the one-line form — or the line and column where it breaks.
Worth knowing
Why the line and the column
The message the browser's engine throws is worded differently in every browser, often says nothing at all about where the problem is, and when it does give a position it gives a count of characters from the start of the file — a number no editor asks you for. This tool reads the document itself and gives the line and the column, which is what you need to get there.
What formatting does not change
Only the spaces and the line breaks change. Numbers and text values are copied exactly as they were written, so a very long whole number keeps all its digits and a value written with a backslash stays written that way. If an object carries the same name twice, both stay — nothing is dropped along the way.
Frequently asked questions
Does my JSON reach the server?
Yes, to be checked. It never goes into the page address, though, so it does not appear in the address bar or in your browsing history, and nothing is kept once the check is done.
Why does the error here look different from the one in my editor?
Because it is not the engine's message, it is this tool's own. Engines word the same mistake differently from one browser to the next, so the page reads the document itself and gives the line and the column.
Does formatting change my numbers?
No. Values are copied exactly as you wrote them, so a very long whole number does not lose its last digits — only the spacing and the line breaks change.
Why is a comma before the closing brace an error?
Because JSON does not allow it, even though many programming languages do. It is one of the commonest mistakes, so the page names it outright rather than calling it an unexpected character.