OmniaTools

JSON Formatter & Validator: How to Format JSON (Free)

Learn how to format, validate, and beautify JSON in your browser. Fix common errors (trailing commas, single quotes, comments). No uploads, no accounts.

The short answer

Paste your JSON into the JSON Formatter, click Format to add clean indentation, or Minify to strip whitespace. If the JSON is invalid, the tool shows the exact error with line and column. Everything runs in your browser — your data never leaves your device.

Why this matters: A single misplaced comma or an unquoted key can break an entire API request. JSON has strict rules — and most developers learn them the hard way. This guide covers the three most common errors and how to fix them fast.

Open JSON Formatter →

Why your JSON "doesn't format" (3 common errors)

1. Trailing comma

Bad: {"a": 1, "b": 2,}
Good: {"a": 1, "b": 2}

JSON does not allow a comma after the last item. JavaScript does — but JSON is not JavaScript. This is the #1 reason JSON "works in my editor but fails in production".

2. Single quotes instead of double quotes

Bad: {'name': 'test'}
Good: {"name": "test"}

JSON requires double quotes for both keys and string values. Single quotes are valid JavaScript, not JSON.

3. Comments

Bad: {"a": 1} // comment
Good: {"a": 1}

JSON has no comment syntax. If you need comments in a config file, use YAML or JSONC (JSON with Comments) — but not strict JSON.

How to find the exact error line

The JSON Formatter shows the parser error with line and column. Example:

JSON error at line 4, column 12: Expected ',' or '}' after property value

This tells you exactly where the parser stopped. Open your file, go to that line and column — the error is usually just before the reported position.

JSON Formatter vs Validator vs Beautifier — what's the difference?

People use these terms interchangeably — but they mean slightly different things:

  • Formatter — reformats valid JSON with clean indentation (2 or 4 spaces).
  • Validator — checks if JSON is syntactically correct. It will reject invalid JSON with an error.
  • Beautifier — same as formatter (synonym). Both add whitespace for readability.
  • Minifier — the opposite: removes all whitespace to save bytes.

Our tool does all of them in one place — format, validate, minify.

Interesting facts about JSON

  • JSON is not JavaScript. Douglas Crockford created JSON in 2001 as a subset of JavaScript syntax — but it is a language-independent data format. You don't need JavaScript to parse it.
  • JSON was almost called "JSML". Before settling on "JavaScript Object Notation", Crockford considered other names. The "JS" stuck, but the format is used by every language from Python to Go.
  • JSON has no comments, by design. Crockford deliberately excluded comments — he believed they would be misused for parsing directives (like in JavaScript).
  • JSON became an ISO standard in 2017. ISO/IEC 21778:2017 — 16 years after it was created.

FAQ

Is my JSON sent to a server?

No. Formatting and validation happen entirely in your browser using native JSON.parse() and JSON.stringify(). Nothing leaves your device.

What's the maximum JSON size?

The practical limit is your browser's available memory — usually several hundred megabytes. No hard limit is enforced.

Why does my JSON fail here but work in JavaScript?

Because JavaScript accepts trailing commas, single quotes, and comments — JSON does not. Your code might be JavaScript, not JSON. This tool validates strict RFC 8259 JSON.

Does it support JSON5 or JSONC?

No. This tool validates strict RFC 8259 JSON. For JSON5 or JSONC (with comments), you'll need a different parser.

Can I convert JSON to YAML?

Yes — use our JSON ⇄ YAML converter.

Related tools

If you need to format, validate, or beautify JSON without uploading it to a stranger's server — this is the tool. No account, no limits, no risk.

Format your JSON now →