JSON Multiline String
Convert multi-line text to a JSON string and back.
JSON Multiline String Converter
JSON has no multi-line strings: a real line break inside quotes makes the whole document invalid. The JSON multiline string converter turns multi-line text — SQL queries, email templates, poems, certificates, shell scripts — into JSON-safe form and back again.
Three ways to store multi-line text
- JSON string with \n – the standard approach. All lines are joined into one string and each line break becomes
\n. Compact and universally supported. - Array of lines –
["line 1", "line 2"]. More readable in the JSON file and friendlier to diffs; join with"\n"in code. - Object property – wraps the string in an object like
{"sql": "..."}, ready to paste into a config file or a request body.
The Trim each line option removes indentation and trailing spaces, which is handy for text copied from code.
Converting back
Switch to JSON to text and paste a JSON string, an array of strings, or a single-property object. The tool decodes every escape and returns the original multi-line text, so you can edit a template comfortably and convert it again.
Typical uses
- Storing SQL or GraphQL queries in JSON configuration.
- Putting email or notification templates into localization files.
- Embedding PEM certificates and private-key placeholders in JSON settings.
- Sending multi-line text through JSON APIs such as chat or ticketing webhooks.
Private and instant
The conversion happens as you type, right in your browser. Queries, templates, and certificates you paste are never uploaded, so it is safe to use with internal or sensitive text.
Related tools
Escape any text as a single JSON string with JSONify String, or escape and unescape without quotes using JSON Escape.
Frequently Asked Questions
Does JSON support multi-line strings?
No. A JSON string must be on one line; real line breaks inside quotes are a syntax error. Line breaks have to be written as the escape sequence \n, which is what this tool does for you.
Why store text as an array of lines?
Arrays keep long text readable in the JSON file itself: each line is its own string, so diffs in version control show exactly which line changed. Your code joins them with "\n" when reading. Jupyter notebooks store cell source this way.
Are Windows line endings handled?
Yes. CRLF (\r\n) and old Mac CR line endings are normalized to \n before conversion, so the output is the same on every platform.
Can I convert back to normal text?
Yes. Switch to “JSON to text”, paste a JSON string, an array of strings, or an object with one string property, and the original multi-line text comes back.