Format and validate JSON
Paste a payload and read it properly. Everything is parsed in this tab, which matters when the JSON has a customer record or an API key in it.
How to use it#
- Paste your JSON into the box, or drop a .json file on it. It is checked as you type.
- Choose Format to beautify it or Minify to strip the whitespace, set the indent, and tick Sort keys to order them alphabetically.
- Copy the result, or download it as a .json file.
Reading the error message#
When JSON will not parse, the message names the line and column where reading stopped and says what was wrong there, which is what most people want from a JSON lint check. That position is where the problem was detected, not always where it was caused. A bracket still open when the file ends is reported where it opened, and a missing comma at the value after the gap.
Three mistakes account for most failures: a trailing comma after the last item, single quotes instead of double quotes, and a line break typed straight into a string. The first two are fine in a JavaScript object literal, which is where the habit comes from. The third is not legal in an ordinary JavaScript string either; it usually arrives when multi-line text is pasted between the quotes, and JSON needs it written as \n, which the JSON escape tool does for you.
JSON copied out of a chat app or a document often carries curly quotes or non-breaking spaces that look right and are not JSON at all. The error names both, since neither shows on screen.
Only the whitespace changes#
A formatter that parses the JSON into JavaScript values and prints them again changes more than the layout. JavaScript holds every number as a double, so an ID of 12345678901234567890 comes back as 12345678901234567000, a price of 1.50 as 1.5, and 1E3 as 1000. This page keeps each number and each string exactly as it was written and changes only the spaces and line breaks between them, whether you beautify or minify.
A key written twice in the same object is valid JSON, but most parsers keep only the last value, so the first is lost without a word. Both stay in the output here, and the page lists every repeated key with its line so you can decide which one was meant.
Why sort keys#
Two API responses that differ in one field are almost impossible to compare by eye when the keys come back in different orders. Sorting both alphabetically turns the comparison into a normal diff.
Key order carries no meaning in JSON, so sorting never changes what the document means to a parser. It is purely for the human reading it.
Pasting real payloads somewhere safe#
A production response often carries tokens or customer email addresses, and many companies forbid pasting those into a service outside their own systems. This page checks and formats the JSON with code that runs in the tab, so the text stays on your machine and nothing is sent anywhere.
You can check that for yourself by opening the network panel while you paste, or by going offline and watching the page keep working.
Frequently asked questions#
Is my JSON sent to a server?
#
No. Checking and formatting happen in this tab, in code the page has already loaded. The page keeps working with your network disconnected, which is the easiest way to confirm it.
Why does my JSON fail to parse?
#
Usually a trailing comma, single quotes instead of double quotes, or an unquoted key. JSON is stricter than a JavaScript object literal: keys must be double-quoted strings and the last item in an object or array must not be followed by a comma.
Does formatting change my data?
#
No. Whitespace changes and nothing else. Numbers and strings are copied as written, so a 19 digit ID or a price of 1.50 comes out exactly as it went in. Key order changes only if you tick Sort keys, which JSON treats as insignificant anyway.
Can it handle large files?
#
Multi-megabyte payloads are fine on a desktop browser. Very large documents (tens of megabytes) can make the text area sluggish, since the constraint is rendering the text, not parsing it.
Does it support JSON5 or comments?
#
No. The checker follows the JSON specification strictly, so comments and trailing commas are reported as errors rather than silently accepted.
What happens when a key appears twice?
#
Both copies stay in the output, in the order they were written, and a line under the result names each repeated key and its line. JSON allows the repeat, but most programs reading the file keep only the last value, so it is usually a mistake worth fixing.