Skip to content
Toolbeam

How to Format and Validate JSON

JSON is easy for machines to read and, when it arrives as one long line, painful for humans. A formatter fixes that, and it also tells you the moment something is broken. Here’s how to use one and how to read the errors.

Format (pretty print) your JSON

  1. Open the JSON formatter.
  2. Paste your JSON.
  3. It re-indents everything into a clean, nested layout you can actually read.

“Pretty printing” just means adding the line breaks and indentation that make the structure visible. The data doesn’t change, only the spacing.

Your JSON is processed in your browser, so you can safely paste API responses or config that contains keys and tokens without sending them anywhere.

Validate: catching the errors

If the JSON is invalid, the formatter won’t be able to lay it out, and that’s your first clue something’s wrong. The usual culprits:

  • A trailing comma. JSON does not allow a comma after the last item in an object or array. {"a": 1,} is invalid.
  • Single quotes. JSON requires double quotes around keys and string values. {'a': 1} is invalid; it must be {"a": 1}.
  • Missing quotes on keys. Every key needs double quotes: {"name": "x"}, not {name: "x"}.
  • Unclosed brackets or braces. One missing } or ] breaks the whole thing.
  • Comments. Standard JSON has no comments. Remove // and /* */ lines.

Fix those and it’ll format cleanly.

Minify: the opposite of pretty

Sometimes you want JSON as small as possible, for example to paste into a config field or send over the wire. Minifying strips the whitespace back out into one compact line. Formatters usually offer both directions.

JSON often travels alongside encoded data. If a value is wrapped in Base64 or URL encoding, those tools will decode it back into something readable.

Tools mentioned in this guide