WebToolsPlanet
Converter Tools

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

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What 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

1

Paste your formatted JSON into the input area or click "Load Sample"

2

The one-line output appears instantly on the right

3

The size stats show the original size, compressed size, and bytes saved

4

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.

Formatted JSON input
{
  "name": "Alice",
  "age": 30,
  "active": true
}
Single-line output
{"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.