JSON

JSON to One Line

Collapse multi-line JSON into a single line — built for logs, env vars, and one-line config fields.

Conversion runs locally in your browser. Nothing is uploaded, logged, or stored.

0 chars
1
Paste multi-line JSON here...
0 chars
Result appears here

How to use

  1. Paste your multi-line JSON into the input panel.
  2. Click Collapse to one line.
  3. Copy the single-line result into your log query, environment variable, or config file.

When do you need one-line JSON?

Many places only accept a single line of text: log aggregators that index one JSON object per line (NDJSON), environment variables, CI secret fields, and message queue payloads pasted into a form. This tool parses your JSON and re-serializes it with no whitespace, producing exactly one line while keeping the document valid.

Because the input is parsed first, irregular indentation and mixed spacing are normalized away — you always get clean, valid JSON out. Going the other way? Use the JSON Formatter to pretty-print a one-liner, or the JSON Viewer to explore it as a tree.

Examples

Structured logging

Flatten a payload before appending it to a log line so each record stays on a single line for NDJSON ingestion.

Environment variables

Most .env formats cannot hold multi-line values — collapse your config object into one line before exporting it.

Frequently Asked Questions

Is my data uploaded anywhere?+
No. The conversion happens entirely in your browser using the native JSON parser.
Is the output still valid JSON?+
Yes. Whitespace between tokens is optional in JSON, so the single-line form parses identically to the pretty-printed original.
Does it change key order or values?+
No. Only insignificant whitespace is removed — keys, values, and array order are preserved exactly.
What about very large documents?+
There is no hard limit; it depends on your device's memory. Typical API payloads collapse instantly.

Related Tools

Looking for something else? Browse all tools