JSON Formatter vs Validator — Which Do You Need?
Pretty-printing JSON and validating JSON are different jobs. Here is when to use which, and how to fix the three errors you will hit most.
JSON looks simple, but the spec is strict. Two characters out of place and the parser throws. Here is the difference between formatting and validating, and why you usually want both.
Formatting
A formatter takes valid JSON and prints it with consistent indentation, sorted keys, and predictable whitespace. It does not change meaning. Use a formatter when:
- You pasted a one-line API response and want to read it
- You are diffing two JSON files in code review
- You are committing a JSON config and want stable line numbers
Try our JSON Formatter — paste, click format, copy back.
Validating
A validator parses the JSON and tells you exactly where it breaks. The three errors you will see 90% of the time:
- Trailing comma —
{"a": 1,}. Strict JSON does not allow them. - Single quotes — JSON only accepts double quotes around keys and string values.
- Unescaped newline in a string — split strings across lines must use
\n.
A formatter that does not validate will silently rewrite broken JSON in confusing ways. Always validate first, format second.
Pro tip: schema validation
For API contracts, schema validation (JSON Schema, Zod, Yup) is a separate layer on top. It checks that age is a number, that email looks like an email, and so on. The browser formatter only verifies syntax — not shape.
When pasting fails
If our tool refuses your input, check for:
- Smart quotes copied from Slack or Notion (
"not") - A BOM character at the start
- HTML
"entities from a copy of escaped JSON
Strip them out and try again.