JSON

JSON Formatter & Validator: The Complete Guide

JSON is everywhere and it only takes one stray comma to break everything. Learn the rules, the common errors, and how to format and validate JSON instantly.

Updated 16 September 2026 · 8 min read
Advertisement

What JSON is

JSON (JavaScript Object Notation) is a text format for structured data. It is human-readable and machine-parseable, which is why APIs, configuration files and logs rely on it.

{
  "name": "Ada",
  "roles": ["admin", "editor"],
  "active": true,
  "score": 42,
  "meta": null
}

Format, validate and minify JSON with the free JSON formatter.

The rules that make JSON valid

  • Data is key/value pairs ("key": value) in objects.
  • Strings use double quotes. Single quotes are invalid.
  • No trailing commas anywhere.
  • Keys must be double-quoted strings.
  • Numbers, booleans (true/false) and null are the other value types.
  • A document has one root value (usually an object or array).

The errors that break parsers

  1. Trailing commas.
  2. Single quotes instead of double quotes.
  3. Unquoted keys.
  4. Comments (not allowed in standard JSON).
  5. Missing or extra brackets and braces.
  6. Unescaped control characters and quotes inside strings.
  7. NaN or Infinity (not valid JSON).

A validator points to the exact line, which turns a frustrating hunt into a two-second fix.

Format vs minify

  • Format (pretty-print) adds indentation and line breaks for humans.
  • Minify strips all unnecessary whitespace for transport.

Use formatted JSON in files you edit; minified JSON in production payloads to save bandwidth.

JSON vs JavaScript objects

They look similar but differ: JSON keys must be quoted, strings must use double quotes, and values cannot be functions or undefined. Copying a JavaScript object literal into JSON often fails for those reasons.

Working with JSON safely

  • Validate before deploying config changes.
  • Never eval() JSON — use a parser.
  • Keep payloads small by minifying.
  • Watch for deep nesting, which hurts readability and performance.

Convert and format free

Paste your JSON into the formatter, get instant validation and pretty-printing, then convert to CSV with the JSON to CSV tool when you need a spreadsheet. Everything runs in your browser.

Advertisement
Help Center

JSON Formatter & Validator: The Complete Guide — FAQ

JavaScript Object Notation is a lightweight, text-based data format. It represents objects, arrays, strings, numbers, booleans and null, and is the default for APIs and config files.

A trailing comma after the last item in an object or array. JSON does not allow trailing commas, while JavaScript does.

No. Standard JSON has no comments. If you need comments, use JSON5 or JSONC (which tools like VS Code and tsconfig accept), then strip them before sending standard JSON.

Keep reading
Advertisement