Short answer
- Format JSON when humans need to read or review it.
- Minify JSON when compact text is easier to store, paste, or transfer.
- Use a diff when you need to inspect the exact before-and-after text.
Format vs minify
| Action | Output | Best for |
|---|---|---|
| Format | Indented, multi-line JSON | Reviewing API responses, config, and examples |
| Minify | Compact one-line JSON | Reducing whitespace before copying or saving |
| Diff | Added and removed text | Checking exactly what changed |
What formatting validates
JSON formatting requires valid JSON syntax. If parsing fails, fix the syntax before formatting or minifying.
A successful format does not prove that the JSON matches a schema or application contract.
Compare output when it matters
Formatting should not change the parsed JSON value, but a text diff can still help you review the exact whitespace and line changes.
FAQ
Does minifying JSON change the data?
No. Minifying removes unnecessary whitespace while keeping the parsed JSON value the same.
Does formatting JSON validate a schema?
No. It checks basic JSON syntax by parsing, but it does not validate application-specific schema rules.
When should I use a text diff?
Use a diff when you need to inspect what changed between the original JSON text and formatted or edited output.