Ctrl + K
Paste plain text or JSON and escape special characters into a valid JSON string, free and client-side.
Paste your plain text or JSON value into the input box above — the tool escapes special characters into a valid JSON string instantly, as you type.
For example, unescaped content with a newline (Line 1 then Line 2 on separate lines) escapes to a single-line string with a literal \n:
Line 1
Line 2
\n
Line 1\nLine 2
JSON (JavaScript Object Notation) is a format for storing and exchanging data that is often used in web applications.
It is a lightweight, text-based format that is easy for humans to read and write, and easy for machines to parse and generate.
You need to escape certain characters inside JSON string values.
Specifically, you must escape:
"
\
Curly braces, square brackets, and colons do not need to be escaped inside strings.
Escaping ensures that your JSON string is valid and can be correctly parsed by software.
In JSON strings, you must escape:
\"
\\
Examples:
\t
\r
These are all escaped using a backslash (\).
If you do not escape special characters in a JSON string, the JSON will be invalid and may fail to parse.
This can cause errors when reading or processing the data, as the parser will not be able to correctly interpret the structure of the JSON.