Skip to content

JSON to One Line

Convert JSON to a single line.

Loading…

About JSON to One Line

Log search boxes, ticket fields, spreadsheet cells and single-line config values do not cope with pretty-printed JSON, because the line breaks split it apart. Paste the document and it comes back as one row of text. A newline inside a string is already written as the two characters \n in valid JSON, so it stays that way and the row never breaks. Conversion runs as you type, and string values and number text are left alone.

Features

  • Single-line output with no newline characters
  • Newlines inside strings stay escaped as \n
  • Converts live while you type
  • Valid or Error marker under the input panel
  • Copy Output button and a text file download

Limitations

  • The whole document goes onto one line; an array of records is not split into one record per line.
  • Nesting deeper than 1,000 levels is refused.
  • Downloading the result needs a free account; copying it does not.

How it works

  1. Paste the pretty-printed JSON into the JSON Input panel.
  2. Watch the Single Line panel fill in as you type; there is no button to press.
  3. Check the marker under the input: Valid means the text converted, and Error means it is not valid JSON.
  4. Select Copy Output to take the one-line text, or Download to save it as output.txt.

Example input

{
  "id": 42,
  "tags": ["json", "compact"]
}

Frequently asked questions