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.
