How to use it
- 1Paste JSON into the box, drop a
.jsonfile onto it, or click “Choose a file”. - 2The formatted result appears as you type. Choose 2 spaces, 4 spaces or tabs for indentation, or Minify to remove all whitespace.
- 3If the JSON is invalid, you’ll see what’s wrong and the exact line and column. Click “Show in the input” to jump straight to the problem.
- 4Turn on “Sort keys A–Z” to order the properties of every object alphabetically – handy before comparing two files.
- 5Copy the result or download it as a
.jsonfile.
What is JSON?
JSON (JavaScript Object Notation) is a plain-text format for structured data. It’s the standard for web APIs and configuration files, and almost every programming language can read and write it.
A JSON document holds one value: an object with name–value pairs in curly braces, an array in square brackets, a string in double quotes, a number, true, false or null. Objects and arrays can be nested as deeply as you need.
Common JSON errors and how to fix them
Most invalid JSON comes from habits that JavaScript, Python or YAML allow but JSON doesn’t: a trailing comma after the last item, single quotes instead of double quotes, property names without quotes, comments, and values such as undefined, NaN or Python’s True and None.
Other frequent culprits are a missing comma between two items, an unescaped double quote or backslash inside a string, and curly quotes pasted from a word processor. The validator names the exact problem and marks where it is – consistently in every browser, even where the browser’s own error message is vague.
Formatting without changing your data
Many formatters read the JSON into JavaScript and print it out again, which quietly changes it: whole numbers above 9,007,199,254,740,991, such as 64-bit IDs, lose their last digits, 1.0 becomes 1, and escape sequences are replaced by the characters they stand for.
This formatter re-indents the text itself, so every number and string stays exactly as you wrote it, and sorting keeps duplicate keys that JavaScript would silently drop. Files of several megabytes format in a fraction of a second; for very large output, syntax colours switch off to keep the page responsive.
Questions and answers
How do I check if my JSON is valid?
Paste it into the box above. Valid JSON shows “Valid JSON” with its line count and size; invalid JSON shows what’s wrong and the exact line and column. The check follows the JSON standard (RFC 8259) – the same rules as JSON.parse in your browser.
Why is a trailing comma an error in JSON?
The JSON standard doesn’t allow a comma after the last item of an object or array, even though JavaScript and many other languages do. Remove the comma before the closing bracket and the JSON becomes valid.
Can JSON contain comments?
No. Standard JSON has no comments, so // and /* */ make it invalid. Formats such as JSONC and JSON5 allow them, but most parsers don’t. To keep a note in plain JSON, put it in an ordinary property such as "_comment".
What does minifying JSON do?
It removes every space, tab and line break outside strings. The data stays identical but the file gets smaller – often by a third or more for indented JSON – which makes API responses faster and saves storage.
Is my JSON sent to a server?
No. Formatting and validation run entirely in your browser, and nothing you paste is uploaded or stored. Once the page has loaded, the tool even works offline.