← All posts
2 min readBy

How to Format JSON Online and Fix Common Errors

Paste messy JSON, make it readable or minify it, and find the exact error. Covers the five mistakes that break JSON, with examples you can copy.

How to Format JSON Online and Fix Common Errors

Quick answer: open the JSON Formatter, paste your JSON and pick 2 spaces, 4 spaces, Tab or Minify. If the JSON is broken, the tool shows the error so you can fix it. Nothing is uploaded: it runs in your browser.

Step by step

  1. Open the JSON Formatter.
  2. Paste your JSON into the box.
  3. Choose how it should look: 2 spaces is the common default, Minify removes every extra space.
  4. Tap Copy.

The five mistakes that break JSON

Mistake Broken Fixed
Single quotes {'name': 'Ali'} {"name": "Ali"}
Trailing comma {"a": 1,} {"a": 1}
Unquoted key {name: "Ali"} {"name": "Ali"}
Comments {"a": 1 // note} remove the comment
Missing bracket {"a": [1, 2} {"a": [1, 2]}

JSON is stricter than JavaScript. Keys and text must use double quotes, and there is no trailing comma and no comment syntax.

Format or minify?

  • Format (pretty print) is for people: indents and line breaks make nested data easy to read.
  • Minify is for machines: the same data on one line, so the file is smaller to send.

Is it safe to paste private data?

The formatter runs entirely in your browser, so your JSON is not sent to a server. Still, avoid pasting real passwords or API keys into any website.

Related tools

Need to encode part of it? Try Base64 encode and decode or the URL encoder. More in all free tools.