JSON String Escape
Escape text for use inside a JSON string: quotes, backslashes, newlines and control characters, optionally ASCII-only.
Runs in your browserText → JSON string
Loading tool…
Example
Line 1 Say "hi" C:\path
Line 1\nSay \"hi\"\tC:\\path
How to use the JSON String Escape
- Paste or type your Text into the input area, or open a file from your device.
- Adjust the options above the editor if the tool offers any.
- Review the JSON string result, then copy it or download it as a file.
Privacy and limitations
- Your data is processed on your device and is not uploaded to any server.
Frequently asked questions
Which characters must be escaped in JSON?
Double quotes, backslashes and control characters below U+0020 (such as newlines and tabs). Everything else, including emoji, may appear as-is in UTF-8 JSON.
Related converters
JavaScript String EscapeEscape text for a JavaScript string literal in single, double or backtick quotes, including \x, \u and U+2028 handling.Unicode EscapeEscape non-ASCII characters as \uXXXX, \u{…}, \U0001F600 or U+ code points for source code and JSON.JSON FormatterBeautify and pretty-print JSON with 2-space, 4-space or tab indentation, with optional key sorting.JSON String UnescapeTurn an escaped JSON string (with or without surrounding quotes) back into plain text, reporting invalid escapes.JavaScript String UnescapeDecode JavaScript escape sequences such as \n, \x41, \u00e9, \u{1F600} and legacy octal escapes into plain text.XML EscapeEscape the five XML special characters (& < > " ') so text is safe in XML element content and attributes.XML UnescapeDecode XML entities (& < > " ') and numeric character references back to plain text.HTML EscapeEscape & < > " and ' so untrusted text can be safely inserted into HTML pages and attributes.