Exactly what JSON needs
Quotes, backslashes and control characters escaped as RFC 8259 asks, and nothing else.
Escape quotes, backslashes, line breaks and control characters so text fits in a JSON string, or unescape one back to plain text, with errors located.
Paste the text or the escaped string
Choose escape or unescape
Copy the result
A message, an SQL query or a block of HTML cannot go into a JSON file as it is. Its quotation marks would end the string early and its line breaks are not allowed inside one. Escaping writes those characters as backslash sequences so the text fits between the quotes and reads back exactly.
The text is escaped with the browser’s own JSON.stringify, which writes what RFC 8259 requires and no more: \" for a quotation mark, \\ for a backslash, \n, \r, \t, \b and \f for those control characters, and \u00XX for the rest of U+0000 to U+001F. The result is wrapped in quotes, ready to paste as a value; untick the option to get the inside of the string only, for pasting between quotes you already have.
Tick the ASCII option to also write every non-ASCII character as a \u escape. An emoji, which lies outside the range four hex digits can reach, becomes two escapes, a surrogate pair, as JSON specifies.
Paste an escaped string, with or without its surrounding quotes, and get the plain text back: \n becomes a line break, \u00e9 becomes é, and a surrogate pair becomes its emoji. The input is checked first, character by character, so an error says what is wrong and where, rather than “unexpected token”.
To check or tidy a whole JSON document, use the JSON formatter. For a value going into a URL rather than JSON, use URL encode, and for HTML, HTML entities.
Nothing is uploaded. The text is escaped in this tab.
Quotes, backslashes and control characters escaped as RFC 8259 asks, and nothing else.
Unescaping names the first bad escape, stray quote or raw line break and the character it is at.
The text is escaped in your browser and never sent anywhere.
Nothing uploaded: open the Network panel while it runs and check.
No daily limits or watermarks: free batches take up to 20 images.
Works offline: once the page has loaded, on any current browser.
Only three kinds. The quotation mark, the backslash, and the control characters U+0000 to U+001F, which include line breaks and tabs. Everything else, accented letters and emoji included, can stay as it is in a UTF-8 file.
It may be written as \/ but does not have to be, and the escape here leaves it as /. Reading back accepts both, since RFC 8259 lists \/ among the allowed escapes.
It writes every character past the ASCII range as \u followed by four hexadecimal digits, and an emoji as a pair of them. The JSON then contains only ASCII, which helps when it passes through a system that mangles UTF-8.
Because the text is not a valid JSON string. The message gives the first problem and where it is, such as an unescaped quote at character 12, a \x escape JSON does not have, or a line break that should be written \n.