JSON to One Line
Paste formatted JSON and compress it into a single minified line. Removes all whitespace, indentation, and line breaks while keeping the data intact.
Last updated: May 28, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is JSON to One Line?
"JSON to One Line" converts a pretty-printed, multi-line JSON document into a compact single-line string by removing all unnecessary whitespace — spaces, tabs, and newlines — while keeping the structure and values identical.
This is the same as calling JSON.stringify(JSON.parse(input)) in JavaScript with no indentation argument. The result is the smallest valid JSON string for that data. It is widely used to minify JSON before embedding it in HTTP request bodies, config strings, environment variables, or any context where size matters.
How to Use JSON to One Line
Paste your formatted JSON into the input area or click "Load Sample"
The one-line output appears instantly on the right
The size stats show the original size, compressed size, and bytes saved
Copy or download the minified output
Common Use Cases
- Developers minifying JSON payloads before including them in HTTP request bodies.
- DevOps engineers storing JSON config as a single-line environment variable.
- Backend engineers embedding JSON in shell scripts or command-line arguments.
- Front-end developers minimizing JSON for inline <script> data islands.
- API engineers reducing bandwidth by removing whitespace from JSON responses.
Example Input and Output
A formatted 4-line JSON object is compressed to a single line.
{
"name": "Alice",
"age": 30,
"active": true
}{"name":"Alice","age":30,"active":true}Privacy
All processing runs in your browser. No data is uploaded to any server.
Frequently Asked Questions
Does this change the data?
No. The tool only removes whitespace characters. The structure, keys, values, and types are identical. The output JSON is semantically equivalent to the input.
What is the difference between "one line" and "minified"?
They are the same thing: producing the most compact valid JSON string with no unnecessary whitespace. "One line", "minified", and "compact" all describe the same output.
What if my JSON is invalid?
The tool validates the JSON before compressing. If the input is invalid, it will show the parse error. Use the JSON Fixer tool to repair broken JSON first.
Is this tool safe for sensitive data?
Yes. All processing runs entirely in your browser. Your JSON is never sent to any server.
How do I go back to formatted JSON?
Use the JSON Formatter tool to re-add indentation and line breaks to any compact or one-line JSON.
Related Tools
JSON Formatter
Format, validate, and beautify JSON instantly — with clear error messages, Tree View, Diff mode, and Schema validation.
JSON Fixer
Fix broken or invalid JSON automatically. Repairs trailing commas, single quotes, bare keys, Python literals, and JavaScript comments.
JSON Serialize Online
Serialize a JSON object into a compact JSON string. Supports compact, pretty-printed, and double-escaped string output modes.
JSON to TOML Converter
Convert JSON to TOML 1.0 — table headers for nested objects, [[array of tables]] for arrays of objects, inline tables for short structures, and proper key quoting.
JSON Multiline String
Escape multiline text into a valid JSON string value, or unescape a JSON string back to readable text. Handles newlines, tabs, quotes, and backslashes.
JSON Stringify Online
Stringify JSON with full control over indentation, key sorting, Unicode escaping, and JS-call wrapping. Mirrors JSON.stringify with extra options. Copy the formatted result.

