Skip to content
FreeToUse

JSON Formatter & Validator — Free

Format, validate and minify JSON instantly. Get clear error messages with line numbers. Free, private JSON beautifier in your browser.

Runs in your browser. Nothing you enter is sent anywhere.

About JSON Formatter

Turn a dense, single-line API response into readable, indented JSON, or squeeze formatted JSON down to the smallest size. If the JSON is invalid, you get a clear message pointing to the line and column of the problem.

How to use JSON Formatter

  1. Paste your JSON into the input box, or load a .json file.
  2. Click "Format" to indent it, or "Minify" to remove whitespace.
  3. If the JSON is invalid, read the error message to find the line and column.
  4. Copy the result or download it as a .json file.

Tips

  • Minified JSON is best for sending over the network; formatted JSON is best for reading and debugging.
  • Two-space indentation is the most common style; use four spaces or tabs if your project prefers it.
  • If you copied JSON from a JavaScript file, remove trailing commas and comments before validating.
  • Sorting keys makes it much easier to compare two JSON responses with the Text Diff tool.

Common JSON errors and how to fix them

Most invalid JSON has one of five causes: a comma after the last item, single quotes instead of double quotes, property names without quotes, comments, or a missing bracket. Values such as undefined and NaN are not allowed either. The validator shows the message from your browser and, where the browser provides it, the line and column, so you can go straight to the problem.

Format, minify and sort

Format JSON with two spaces, four spaces or tabs to read an API response or a configuration file. Minify it to remove all unnecessary spaces before sending or storing it. Sort keys to make two responses comparable. Like any JavaScript tool, it reads numbers as double-precision values, so whole numbers above 9,007,199,254,740,991 can be rounded; keep very long IDs as strings.