Formatting vs validating
Formatting (pretty-printing) re-indents valid JSON so you can read it; minifying does the reverse to save bytes. Validation checks that the text is legal JSON at all. The JSON Formatter does both: invalid input reports the line and column of the first error.
The five most common errors
| Error | Invalid | Valid |
|---|---|---|
| Trailing comma | {"a": 1,} | {"a": 1} |
| Single quotes | {'a': 1} | {"a": 1} |
| Unquoted key | {a: 1} | {"a": 1} |
| Comment | {"a": 1 // id} | {"a": 1} |
| NaN or undefined | {"a": NaN} | {"a": null} |
Large numbers and precision
JavaScript stores numbers as 64-bit floats, so integers above 9,007,199,254,740,991 lose precision when parsed. If you work with large IDs, keep them as strings in your JSON.
Useful workflow
- Validate first, fix errors from the reported line.
- Format with sorted keys before comparing two versions in the Code Diff Checker.
- Convert arrays of objects to CSV for spreadsheets with JSON to CSV — nested objects become dotted columns.
Key takeaways
- JSON allows no comments, trailing commas or single quotes.
- Use the reported line/column to fix errors quickly.
- Keep very large IDs as strings.
Published 18 November 2026 by the Cloude Tools team.