How do I format and validate JSON online?
Paste your JSON into FixDoks's JSON Formatter and click Format to beautify it with clean indentation, or Validate to check it. If the JSON is broken, it shows the exact line and column of the first error, such as a trailing comma or a missing quote. Minify compresses it, and everything runs in your browser.
JSON Formatter at a glance
| Input | JSON text or a .json file up to 50 MB |
|---|---|
| Output | Formatted, minified or validated JSON with error line and column |
| Processing | In your browser; your files are not uploaded |
| Price | Free |
| Works on | Chrome, Edge, Safari and Firefox on Windows, Mac, Android and iPhone |
How to use JSON Formatter and Validator
- Paste your JSON or click Open .json file.
- Choose an indent (2 spaces, 4 spaces or tab) and whether to sort keys.
- Click Format JSON to beautify, Minify to compress, or Validate to only check it.
- If there is an error, the message shows the line, column and a pointer to the problem.
Format and check JSON in one step
JSON from an API response, a log file or a config export often arrives as one long unreadable line. Paste it here and FixDoks lays it out with clean indentation so you can read the structure. If the JSON is broken, you get the exact position of the first error instead of a vague "unexpected token" message.
Clear error messages
Browsers describe JSON errors differently, and some do not give a line number at all. This tool runs its own strict JSON check first, so it can tell you, for example, "Invalid JSON at line 14, column 3: Trailing comma before }". It also shows that line with a caret under the problem and selects the spot in the input box. The most common mistakes it catches:
- Trailing commas after the last item in an object or array. JavaScript allows them, JSON does not.
- Single quotes around strings or keys. JSON only accepts double quotes.
- Keys without quotes, such as {name: "Asha"}.
- Comments (// or /* */). Standard JSON has no comments.
- Missing commas between items, and unclosed strings, brackets or braces.
- Values like NaN, undefined or numbers with a leading zero such as 007.
Format vs minify
Format (also called beautify or pretty print) adds line breaks and indentation. Use it for reading, debugging and committing config files. Minify removes all unnecessary whitespace to make the smallest possible file, which is what you want to send over a network or store in a database. The status line shows the output size in bytes.
Sort keys
Ticking Sort keys A to Z orders the keys in every object alphabetically, at every level. It makes two JSON files much easier to compare: sort both, then paste them into the text compare tool and only real differences remain. Arrays keep their order, because in JSON the order of array items has meaning.
Good to know
- A byte order mark (BOM) at the start of a file, common in files saved by Windows Notepad, is ignored automatically.
- JavaScript numbers are precise up to 15 to 16 digits. Very large integers, such as some database IDs, may be rounded when formatted. If exact digits matter, keep such IDs as strings in your JSON.
- Files up to 50 MB can be opened. Large files format quickly, but showing several megabytes of text in the output box can take a few seconds.
Need a spreadsheet instead? Convert an array of objects with JSON to CSV, or go the other way with CSV to JSON.