JSON to One Line
Flatten an indented document into a single compact line that fits into a log entry, a header or an env variable.
Your data stays on your device
Input — JSON
- characters
- 0
- lines
- 0
- size
- 0 B
Output — Single-line JSON
- characters
- 0
- lines
- 0
- size
- 0 B
About this tool
Some places want JSON on exactly one line: a structured log field, an environment variable, an HTTP header, or a cell in a spreadsheet. This tool removes the line breaks and indentation while keeping the document valid.
It parses the input first, so the single-line result is guaranteed well-formed. This is the same operation as minifying, framed for the specific case where you need the whole value on one line.
How to use this tool
- Paste multi-line JSON or upload a file.
- Press Collapse to remove the line breaks and indentation.
- Copy the single-line result into your log line, header or variable.
- Use the JSON Beautifier to expand it again later.
Key features
- Removes all insignificant whitespace in one step
- Output remains valid, parseable JSON
- Reports the byte size before and after
- Reversible with the Beautifier or Formatter
- Client-side only — safe for sensitive payloads
Example
Input — JSON
{
"id": 1,
"ok": true
}Output — JSON
{"id":1,"ok":true}Good to know
- Strings that contain literal line breaks keep them, because removing those would change the data.
- The input must be valid JSON; repair broken input first with the JSON Repair tool.
Frequently asked questions
Is this the same as minifying?
Technically yes — both strip insignificant whitespace. This page is aimed at the common need to get a value onto a single line.
Will it break strings that contain newlines?
No. Line breaks inside string values are part of the data and are preserved as escaped characters.
Does it upload my JSON?
No. The whole operation runs locally in your browser.
Your data stays on your device
Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.