HTML Formatter
Beautify and indent HTML markup.
OpenValidate JSON and reprint it on one line, with every insignificant space removed.
Add an indented payload, fixture or config file.
Invalid JSON stops here and the parser error is shown.
Valid input is written back on one line with no spare whitespace.
Copy the result or download it as min.json.
Pretty JSON is for people; compact JSON is for request bodies, environment variables and log lines. You have a nicely indented fixture and need it on a single line for a curl command or a test assertion.
Instead of deleting whitespace with a regex, the minifier parses your input with JSON.parse and writes it back with JSON.stringify. Spaces inside string values are preserved, the output is guaranteed to be valid JSON, and a broken document is refused with the parser's error rather than turned into something subtly worse. Output updates live; copy it or download min.json.
Parsing has side effects worth knowing: duplicate keys collapse to the last value, and integers larger than 2^53 are rounded. Trailing commas and comments are not accepted, so fix those in the JSON beautifier first, where you can see the structure. Keep the pretty version in version control and minify at send time, because hand-editing a one-liner is an easy way to introduce a syntax error. If an API expects the compact JSON encoded, pass it to the Base64 encoder, or follow the full JSON to Base64 recipe on the blog.
The round trip through the browser's JSON engine happens locally, and no copy of the payload is kept.
Recipe: JSON format → minify → Base64 · JSON Formatter
Keyboard shortcut
Fit a request body on one line inside a shell command.
Keep sample events to a single line for log-based tests.
Store a small JSON config in a single environment variable.
Answers for this tool. For site-wide help, open the FAQ hub.
No, with one exception defined by JavaScript itself: keys that look like non-negative integers, such as "2" or "10", are moved to the front in numeric order. All other keys keep the order they had in the input.
The output is the same. This page is a focused single-purpose view for when you only ever want compact output, with min.json as the download name.
Not directly. The input must be a single JSON value, so several objects on separate lines fail to parse. Wrap them in an array, or minify each line on its own.