NV ToolkitFormat · Validate · Convert

JSON Tools

JSON to One Line Converter

Strip every line break and indent from your JSON to get a clean single-line version — perfect for logs, env vars, and curl.

In short

Convert JSON to one line online: remove all line breaks and indentation to get compact single-line JSON for logs, env vars, curl commands and HTTP payloads.

By NaveenKumar T · Updated

Learn: What is JSON? A Practical Introduction

  • One-click single-line output
  • Validates while converting
  • Shows exact size savings

Runs entirely in your browser — nothing you paste or open here is uploaded, logged, or stored.How we handle data →

Example

JSON to One Line: input and output

A pretty-printed support ticket squeezed onto a single line for a log entry.

Pretty JSON
{
  "id": "TCK-4471",
  "priority": "high",
  "tags": ["billing", "urgent"],
  "assignee": null
}
One-line JSON
{"id":"TCK-4471","priority":"high","tags":["billing","urgent"],"assignee":null}

Every line break and indent is gone, but the value is byte-for-byte the same JSON — paste it into a log line, a curl -d flag, or an env var without a wrapping newline breaking it.

Learn more

JSON one-liner: when a single line is the right format

A JSON one-liner is the same document with every line break and indent removed — the right format whenever something else treats a newline as a delimiter. Modern logging pipelines treat each line as one event — a pretty-printed JSON object splattered across 40 lines becomes 40 broken events, so converting payloads to a single line keeps logs machine-parseable and grep results meaningful. The same constraint shows up in .env files, CSV cells, and shell commands.

This converter is a full JSON parse and re-serialization, not a naive newline strip: it validates your document (with exact error positions if it's broken) and guarantees the one-liner output is byte-perfect valid JSON.

One line vs. minified

For JSON they're effectively the same operation — minification removes line breaks and spaces between tokens. The status bar shows your before/after sizes; typical pretty-printed documents shrink 20–40%, which also makes this the quickest way to estimate payload savings before you ship.

Help

Frequently asked questions

Everything you need to know about the JSON to One Line.

01How do I convert JSON to one line?

Paste your formatted JSON and click To One Line. All line breaks, indentation, and insignificant spaces are removed, producing the most compact valid representation of your document — ready for the clipboard or download.

02Does converting to one line change my data?

No. Whitespace between JSON tokens carries no meaning, so the single-line version parses to exactly the same value. Whitespace inside string values is always preserved.

03Why would I need single-line JSON?

Structured log entries must be one line to stay greppable; environment variables and .env files can't contain raw newlines; curl -d payloads are easiest to quote on one line; and many config formats embed JSON in a single string field.

04How do I make one-line JSON readable again?

Paste it back here and click Beautify — or use the JSON Formatter / Pretty Print tools. One-line and pretty JSON are the same data in different clothes.

Keep working

Related tools

Learn the format

Related guides

All guides →