{Asad Webs}
← Toolz / Developer Tools / JSON Formatter & Validator
DEV·03

JSON Formatter & Validator

Pretty-print, minify and validate JSON — with the exact position of any error.

Paste JSON below and choose an action. Everything runs locally in your browser — API responses, tokens and config files are never uploaded.

0 characters0 lines
UNDERSTAND YOUR RESULTS

JSON Formatter & Validator — Format, Minify & Check JSON guide

Format messy JSON into clean, readable output with 2- or 4-space indentation, minify it back to one line, and validate it with the exact line and column of any syntax error. Runs entirely in your browser.

How to use this tool

  1. Paste your JSON into the editor. The character and line counts update as you type.
  2. Choose Format · 2 spaces or Format · 4 spaces to pretty-print, Minify to compress it to a single line, or Validate only to check it without changing anything.
  3. If the JSON is invalid, the error panel shows the parser message with the exact line and column and points at the offending spot. Fix it, then copy the result or download it as a .json file.

A worked example

The minified text {"a":1,"b":[2,3]} formats to a short multi-line document with each key on its own line. A trailing comma such as {"a":1,} is invalid JSON — the validator reports the position where the parser failed so you can find and remove the comma.

How it works

Formatting uses the browser's built-in JSON parser: the text is parsed into a value, then re-serialised with JSON.stringify using the indentation you chose. Validation is the same parse on its own. When parsing fails, the error message (which includes a character position in most browsers) is converted into a line and column, and the line is shown with a caret under the problem.

Frequently asked questions

Is my JSON uploaded anywhere?

No. Parsing and formatting happen locally in your browser. API responses containing tokens or personal data stay on your device.

Why does the validator say my JSON is invalid?

The most common causes are trailing commas, single quotes instead of double quotes, unquoted property names, comments, or a missing comma or brace. The error panel points at the line and column where the parser gave up.

What is the difference between format and minify?

Formatting adds line breaks and indentation so people can read the structure. Minifying removes all optional whitespace to make the file as small as possible for machines. Both represent exactly the same data.

Does formatting change my data?

No — keys, values and array order are preserved. Only whitespace changes. Note that number formatting follows the JavaScript parser, so a value like 1.0 becomes 1.

Can I validate JSON5 or JSON with comments?

No. This validator follows the strict JSON standard, which is what APIs and config files almost always require. Remove comments and trailing commas first.