JSON Multiline String
Paste multiline text and escape it into a valid JSON string value — or paste an escaped JSON string and unescape it back to readable text.
Last updated: May 21, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is JSON Multiline String?
JSON strings must be on a single line and have certain characters escaped: double quotes become \", newlines become \n, tabs become \t, backslashes become \\, and non-ASCII characters become \uXXXX sequences. When embedding long SQL queries, HTML templates, code snippets, or multi-paragraph text as a JSON value, this escaping must be done precisely — even a single unescaped newline makes the JSON invalid.
This tool converts in both directions: Escape mode takes raw multiline text and produces a single-line JSON string value you can paste directly into JSON. Unescape mode takes an escaped JSON string value and restores the original readable text with real newlines and characters.
How to Use JSON Multiline String
Choose Escape (text → JSON string) or Unescape (JSON string → text)
Paste your input into the text area or click "Load Sample"
The output updates instantly
Copy the result and paste it into your JSON or code
Common Use Cases
- Developers embedding multi-line SQL queries as JSON string values in config files or API payloads.
- Engineers storing HTML templates or email bodies as JSON string properties in configuration.
- Developers embedding code snippets in JSON data files for documentation or test fixtures.
- API developers encoding multi-paragraph text or markdown content as a single JSON string.
- Teams debugging escaped JSON strings from logs by unescaping them to readable text.
- Developers embedding shell scripts or command strings in JSON configuration objects.
Example Input and Output
A multiline SQL query is escaped into a single valid JSON string value.
SELECT id, name, email
FROM users
WHERE active = true
AND created_at > '2024-01-01'
ORDER BY name ASC;SELECT id, name, email\nFROM users\nWHERE active = true\n AND created_at > '2024-01-01'\nORDER BY name ASC;Privacy
All processing runs in your browser. No data is uploaded to any server.
Using in JSON5 or YAML
JSON5 supports multi-line strings with backslash line continuation, and YAML supports literal block scalars (|) that preserve newlines. If you control the format, consider using those instead of escaping — they are more readable.

