What JSON minification does
JSON is usually written with indentation and line breaks so people can read it. A parser does not need any of that whitespace. Minifying removes every space, tab and newline that sits outside a string, which leaves the data unchanged but makes the file smaller. Smaller payloads download faster and cost less to store and send, which adds up for APIs that return the same structure thousands of times a minute.
Minify or prettify
- Minify puts the whole document on one line. Use it for API responses, config embedded in HTML, or anything a machine reads.
- Prettify adds line breaks and indentation (2 spaces, 4 spaces or tabs) so you can read and review the structure. Use it when debugging a response or committing JSON to a repository.
This tool works on the text itself rather than parsing and re-serialising it, so numbers stay exactly as you wrote them. That matters for large integers such as 64-bit IDs, which JavaScript would otherwise round. Key order and escape sequences are also left alone. Everything runs in your browser; nothing is uploaded.
How much does it save?
It depends on how deeply nested the data is. Typical pretty-printed API responses shrink by 15 to 40 percent. If your server already uses gzip or Brotli compression, the gain over the wire is smaller because compression handles repeated whitespace well, but minified JSON is still faster to parse and smaller in memory and storage.
Common JSON errors
When the input is not valid, the tool shows the line and column of the first problem. The usual causes are:
- Trailing commas, as in
[1, 2, 3,]. JavaScript allows them, JSON does not. - Single quotes. Strings and property names must use double quotes:
{"name": "Ada"}. - Unquoted property names, as in
{name: "Ada"}. - Comments. JSON has no comment syntax. Remove
//and/* */lines. - Python or other literals like
True,None,NaNorundefined. JSON only knowstrue,falseandnull. - Raw line breaks inside strings. Write
\ninstead.