About formatting and minifying JSON
JSON (JavaScript Object Notation) is a lightweight, structured text format used everywhere in web development — API responses, configuration files, and data exchange between services. Formatted ("pretty-printed") JSON with indentation is easy for humans to read and debug, while minified JSON with all unnecessary whitespace removed is smaller and faster to transmit, which is why developers often need to switch between the two.
How formatting and minifying work
This tool first parses your input as JSON to confirm it's valid, then re-serializes it: formatting rebuilds the structure with your chosen indentation (2 spaces, 4 spaces, or tabs) so nested objects and arrays are easy to scan, while minifying strips all indentation and line breaks to produce the most compact valid representation. If the input isn't valid JSON, parsing fails and the specific error is shown instead.
Frequently asked questions
- Why does it say my JSON is invalid?
- Common causes are a trailing comma after the last item, missing quotes around a key, using single quotes instead of double quotes, or an unclosed bracket or brace. The error message shows roughly where the parser stopped, which helps narrow down the problem.
- Is my data sent to a server for formatting?
- No. Parsing, formatting, and minifying all happen locally in your browser using JavaScript's built-in JSON parser — your JSON is never uploaded anywhere, which makes it safe to use with sensitive data or API keys.
- What's the difference between formatting and minifying?
- Formatting adds indentation and line breaks to make JSON easy to read; minifying removes all of that to make the JSON as small as possible for transmission or storage. Both represent exactly the same data — only the whitespace differs.