JSON Multiline String Converter
Put multi-line text — SQL, PEM keys, templates — into a JSON string with \n escapes, or as an array of lines, and convert it back.
About this result
What It Does
JSON has no multi-line string syntax — a line break inside a string must be written as \n. This tool takes multi-line text, such as a SQL query, a PEM certificate or an email template, and turns it into a single valid JSON string. It can also produce an array with one element per line, which is easier to edit and diff. Switch direction to turn either form back into real multi-line text.
When to Use It
- You need to store a SQL query or a shell script in a JSON config file.
- A PEM private key or certificate has to go into a JSON secret or environment config.
- You are writing an email or Slack message template into a JSON localisation file.
- You received a JSON value full of \n and want to read it as normal text.
Worked Examples
SELECT id, email
FROM users
WHERE active = true
Becomes "SELECT id, email\nFROM users\nWHERE active = true" — one line, ready to paste after a key.
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE
-----END PUBLIC KEY-----
Tick One array element per line to get a three-element array, which keeps a long key readable in a config file.
"Dear {name},\n\nThanks for signing up."
The reverse: the escaped string becomes three lines of text, with the blank line preserved.
Features
How to Use
1. Paste your input into the top box. 2. Adjust the options if the page has any — the result updates as you type. 3. Read the notes under the result, then copy it.
Common Mistakes
- Editing the result by hand and breaking the escaping. If you need to change the content, change the input and run it again — a single stray backslash makes the whole value invalid.
- Assuming the browser preserved Windows line endings. A pasted CRLF becomes LF in any text box, so a byte-exact comparison with the original file can still differ.
- Trusting that two documents are equal because they look equal. Key order, whitespace and number formatting differ between serializers; compare parsed values, not text.
Frequently Asked Questions
Related Tools
Everything runs in your browser. Your JSON is never uploaded, logged or stored.