Irreva logo
Explore Irreva
DeveloperJanuary 7, 2026· 6 min read· Updated June 10, 2026

How to Format and Validate JSON Online

Hasanur Rahman

Written by Hasanur Rahman

Founder & Full-Stack Developer · Irreva · Rangpur, Bangladesh

JSON is the default language of the web. APIs return it, config files use it, and databases store it. But raw JSON — especially a minified blob from an API response — is nearly impossible to read at a glance. Formatting it adds indentation and line breaks that make the structure obvious. This guide covers how to format and validate JSON online in seconds, what the common errors mean, and why it matters.

What JSON formatting actually does

JSON formatting, sometimes called pretty-printing, takes a compact JSON string and adds whitespace — indentation and newlines — to reflect the data hierarchy visually. A 500-character single-line API response becomes a clearly structured tree you can read and navigate.

Beyond readability, a good formatter also validates the JSON as it parses it. If there's a syntax error — a missing comma, an unquoted key, a trailing comma — the formatter identifies where the problem is so you can fix it without guessing.

The Irreva JSON Formatter runs entirely in your browser. Paste your JSON, click format, and get back a neatly indented result with syntax highlighting. Nothing is sent to a server.

  • Pretty-print: adds indentation and line breaks
  • Validate: checks syntax and highlights errors
  • Minify: removes all whitespace for smaller payloads
  • Copy: one-click copy of the formatted result

Common JSON errors and how to fix them

Trailing commas are the most common JSON error, especially for developers coming from JavaScript where trailing commas in arrays and objects are allowed. JSON is stricter — the last item in an array or object must not have a comma after it.

Single-quoted strings are another frequent mistake. JSON requires double quotes around both keys and string values. Single quotes are not valid JSON, even though JavaScript accepts them.

Comments are not allowed in JSON. If you paste a config file that uses // or /* */ comments, the parser will reject it. You'll need to strip comments before the file is valid JSON.

Numbers with leading zeros — like 007 — are also invalid. Use plain integers or decimals without leading zeros.

  • Trailing comma after last object property or array item
  • Single quotes instead of double quotes
  • Comments (// or /* */) in the JSON
  • Unquoted keys
  • Leading zeros in numbers

When to minify vs format JSON

Formatted JSON is for humans: debugging, code reviews, documentation, reading API responses. Minified JSON is for machines: API payloads, production config files, anything where payload size matters.

For a typical API serving millions of requests per day, the difference between formatted and minified JSON in each response payload can translate to meaningful bandwidth savings. Formatted JSON might be 3–4x larger than its minified equivalent due to whitespace.

The JSON Formatter on Irreva supports both directions — format to expand and minify to collapse. Use the format view when working with it and minify before deploying.

Validating JSON against a schema

Basic validation just checks that JSON is syntactically correct — proper quotes, no trailing commas, balanced brackets. Schema validation goes further and checks that the data structure matches what your application expects.

JSON Schema is the standard for defining the expected shape of a JSON document. You can specify required fields, data types, value constraints, and nested object structures. Tools like the Irreva JSON Formatter can check syntax; for schema validation you'd use a dedicated JSON Schema validator.

For most day-to-day debugging tasks, syntax validation is all you need. Schema validation becomes important when you're building integrations, writing API contracts, or testing that third-party responses match your expectations.

Frequently Asked Questions

Is the JSON formatter free to use?

Yes. The Irreva JSON Formatter is completely free with no account required and no usage limits. It runs in your browser, so your data stays on your device.

Why does my JSON show an error even though it looks correct?

The most common hidden errors are trailing commas after the last item in an array or object, single quotes instead of double quotes, and comments that aren't valid in JSON. Paste your JSON into the formatter and it will point to the exact line with the problem.

Can I format very large JSON files?

Yes, within the limits of your browser's memory. Files up to several megabytes format quickly. Very large files (100MB+) may be slow or cause the browser tab to run out of memory.

What is the difference between JSON and JavaScript objects?

JSON is a text format derived from JavaScript object syntax, but it has stricter rules. JSON requires double quotes on keys and string values, doesn't allow trailing commas, doesn't allow comments, and doesn't support special values like undefined or functions that JavaScript objects can have.

How do I format JSON in a terminal?

You can use Python: echo '{"key":"value"}' | python3 -m json.tool. Or use jq: cat file.json | jq. Both are available on most Linux and macOS systems.

Hasanur Rahman

About the author

Hasanur Rahman

Founder & Full-Stack Developer · Irreva · Rangpur, Bangladesh

Hasanur Rahman is the founder of Irreva and a full-stack developer based in Rangpur, Bangladesh. He builds all of Irreva's tools with a focus on privacy-first, browser-based processing.