Paste valid JSON into the JSON Formatter, choose two- or four-space indentation, and format. Compare the output structurally rather than relying on the same whitespace. Try JSON Formatter.
What a JSON formatter actually changes
A compact API response and an indented response can represent the same arrays, objects, strings, booleans, and nulls. Whitespace between JSON tokens has no meaning. Inside a quoted string it does: a space in a customer name or a newline escaped as \n remains part of the value.
For example, the one-line object {"item":"A","qty":2} becomes a multi-line object with the same two properties. Pretty-printing makes nested arrays and objects easier to scan, especially during reviews and debugging. It does not create extra data or add comments, which standard JSON does not support.
- Use two spaces for compact diffs and four when reviewing deeply nested structures.
- Keep the original payload for comparison.
- Check the destination application still accepts the file.
Do not confuse formatting with fixing invalid JSON
The formatter parses the entire document first. Missing quotation marks around keys, a trailing comma after the last property, or single-quoted strings are not valid JSON and must be fixed before formatting can succeed.
Another important boundary is numerical fidelity. Some JSON numbers cannot be represented exactly by JavaScript's number type; this tool rejects unsafe integer literals instead of silently rounding them. Numeric spelling and repeated object keys may also normalize during a parse-and-serialize round trip.
- Validate syntax first if the source comes from an untrusted export.
- Use a domain-specific parser when exact large-number representation is essential.
A safe formatting workflow for API responses
Copy the original response into a temporary file so you can compare it later. Paste a small representative example into the browser tool, select indentation, and run Format JSON. If it reports an error, correct the source rather than inventing fields to make the parser happy.
After formatting, check that identifiers, array lengths, and value types still match expectations. A quoted order number such as "00127" is a string and should stay quoted: converting it to a number would remove the leading zeros. Copy or download the formatted result only after these checks.
- For schema rules, use JSON Schema Validator separately.
- For a smaller API payload, use JSON Minifier after validation.
Common formatting mistakes
Formatting alone never checks whether a customer record has the required fields. A syntactically valid object can still be wrong for your application. If a pipeline expects an array of records but receives a single object, the formatter cannot diagnose that business-level mismatch.
Avoid repeatedly converting between JSON and spreadsheets when objects contain nested lists. Use the Data Converter only when the target tabular structure is appropriate; otherwise retain JSON's nested structure.
Common questions
Does formatting change JSON values?
Ordinary whitespace outside strings is removed and reinserted. Parsing may normalize number representations or duplicate keys, so retain the original for sensitive payloads.
Can it fix trailing commas?
No. The document must be valid JSON before it can be formatted.