Home / Tools / JSON formatter and validator

JSON formatter and validator

Paste JSON to tidy it up, shrink it, or find exactly where it's broken. Everything happens in your browser, so it's safe for API responses.

  • Code tool
  • Runs in your browser
  • Tested 19 November 2026
  • Sources

The mistakes that break JSON

JSON is strict. These are the errors we see most, and the validator points to the line and column of each:

  • Trailing commas. [1, 2, 3,] is fine in JavaScript and Python but invalid in JSON.
  • Single quotes. Strings and keys must use double quotes: {"name": "Pico"}, not {'name': 'Pico'}.
  • Unquoted keys. {name: "Pico"} is a JavaScript object, not JSON.
  • Comments. JSON has no comments at all.
  • Python values. True, False and None must be true, false and null. Use json.dumps() rather than str() to turn a Python dictionary into JSON.
  • Raw line breaks inside strings. Write them as \n.

Formatting and minifying

Formatting adds line breaks and indentation so people can read the structure. Minifying removes every unneeded space to make the data smaller to send. Both produce identical data. In Python, json.dumps(data, indent=2) formats and json.dumps(data, separators=(",", ":")) minifies.

New to JSON? JSON for beginners explains objects, arrays and how AI APIs use them.

Sources

Where the formulas and figures on this page come from. We test every tool against worked examples from these before publishing.