What the JSON Formatter Does
APIs and config files often deliver JSON on a single line with no spacing, which is hard to read and harder to debug. Format parses the text and rewrites it with consistent indentation, one key per line. Minify does the reverse and strips all optional whitespace to make the payload as small as possible. Validate only checks the syntax and reports the first error it finds, including its line and column. Everything runs locally with your browser's built-in JSON parser.
Rules for Valid JSON
- Keys and string values must use double quotes; single quotes are not allowed.
- Items are separated by commas, with no trailing comma after the last item.
- Objects use
{ }and arrays use[ ]; values can be strings, numbers,true,false,null, objects or arrays. - Comments (
//or/* */) are not part of the standard (RFC 8259).
Example: Common Mistakes
{ "name": "Alex", "age": 30, } // invalid: trailing comma
{ 'name': 'Sam' } // invalid: single quotes
{ age: 25 } // invalid: unquoted key
{ "age": 25 } // valid
Frequently Asked Questions
Can I put comments in JSON?
No. Standard JSON does not allow comments, so a file containing // or /* */ will be reported as invalid. Some tools accept JSONC or JSON5, which do allow comments, but strict parsers will reject them.
Is my JSON sent to a server?
No. Formatting, minifying and validation all happen in your browser. The text you paste is not uploaded or stored.
What does "Unexpected token" mean?
The parser found a character where it did not expect one, most often a trailing comma, a single quote, an unquoted key or a missing comma between items. The error message shows the line and column so you can jump straight to it.
What is the difference between JSON and XML?
Both store structured data. XML wraps values in opening and closing tags and supports attributes, which makes it more verbose. JSON is shorter and maps directly to objects and arrays in JavaScript and most other languages, which is why most web APIs use it.