Minify and validate JSON locally
Pretty-printed JSON is easy to read but wastes bytes in API payloads, config files and storage. This tool strips every bit of insignificant whitespace to produce a single compact line, and because it parses the input first you get validation in the same step — invalid JSON shows the exact parser error instead of silently producing broken output.
How it works
The minifier runs JSON.parse on your input to build the data structure, then
JSON.stringify with no indentation argument to serialise it back as compactly
as possible. Because it works on the parsed data rather than the raw text:
- spaces and newlines inside string values are preserved;
- only insignificant whitespace between tokens is removed;
- anything that is not valid JSON is rejected with the parser’s error message.
After minifying, the tool reports the new character count and how much you saved.
Example
This pretty-printed input:
{
"name": "api",
"tags": [ "a", "b" ]
}
minifies to:
{"name":"api","tags":["a","b"]}
The data is identical; only the indentation and spacing between tokens are gone. It runs entirely in your browser, so sensitive data is never uploaded.