JSON Formatter and Validator

Beautify, minify and validate JSON with the exact line and column of any error.

Runs in your browser. Your files never leave your device.

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

InputJSON text or a .json file up to 50 MB
OutputFormatted, minified or validated JSON with error line and column
ProcessingIn your browser; your files are not uploaded
PriceFree
Works onChrome, Edge, Safari and Firefox on Windows, Mac, Android and iPhone

How to use JSON Formatter and Validator

  1. Paste your JSON or click Open .json file.
  2. Choose an indent (2 spaces, 4 spaces or tab) and whether to sort keys.
  3. Click Format JSON to beautify, Minify to compress, or Validate to only check it.
  4. 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.

Frequently asked questions

Is my JSON sent to a server?
No. Formatting and validation run entirely in your browser, so API keys or customer data in the JSON stay on your device.
Why does it say trailing comma?
There is a comma after the last item in an object or array, for example {"a":1,}. Remove that comma and the JSON becomes valid.
Can it fix invalid JSON automatically?
No. It shows exactly where the first error is so you can fix it. Automatic fixing can silently change your data, so it is safer to correct it yourself.
Does it support JSON with comments (JSONC)?
No. Comments are not part of standard JSON and are reported as errors. Remove them first.
What indent should I use?
Two spaces is the most common choice for web projects. Four spaces or tabs are fine too. Pick whatever your project already uses.