jsonecho

JSON to One Line

Collapse JSON onto one line so it fits in a log entry, a curl command or a spreadsheet cell.

Loading the tool...

How to use JSON to One Line

  1. Paste your formatted JSON.
  2. Copy the single line from the right-hand box.

About JSON to One Line

Logging systems usually treat each line as a separate event. If you log pretty printed JSON, one object ends up scattered over twenty entries. A single line avoids that, and so does a line of JSON in a shell command where a line break would end it.

The tool also checks that your JSON is valid, so you do not paste something broken into a production config.

Frequently asked questions

Will it break if my JSON contains line breaks inside strings?

Line breaks inside a string are stored as the two characters \n in valid JSON, so they stay as they are. A raw line break inside a string would make the JSON invalid, and you would see an error.

Can I put the result in a curl command?

Yes. Wrap it in single quotes on macOS and Linux, for example curl -d '{"a":1}'. On Windows cmd you need double quotes with the inner quotes escaped.

Is this the same as JSON Minify?

The output is identical. The two pages exist because people search for them with different words. Use whichever name you remember.

More in JSON Tools

All tools →