- When do I need to escape JSON?
- Whenever you embed a JSON string inside another string: storing JSON in a database TEXT column with single-quote SQL escaping, putting JSON inside an HTML data- attribute, sending JSON as a JWT claim, logging JSON safely so newlines do not break log parsers, or building a JSON string literal inside another JSON document.
- What characters get escaped?
- Per RFC 8259: the backslash \\ becomes \\\\, the double quote " becomes \\", and control characters (newline, tab, carriage return, backspace, form feed) become their two-character escape sequences \\n, \\t, \\r, \\b, \\f. Unicode characters above U+007F are left as-is (a valid choice per the spec).
- What is the difference between escape and stringify?
- JSON.stringify on a string wraps it in quotes AND escapes the content. This tool offers both modes. "Escape" is what you want when embedding a string in source code; "stringify" (escape + wrap quotes) is what you want when embedding the result back into another JSON document.
- Does this handle Unicode correctly?
- Yes. Characters above U+007F are passed through unchanged by default (a valid JSON), which keeps the output readable and smaller. If you need ASCII-only output, use the \\uXXXX escape mode in the toggle below the input.
- Why does my escaped string still break?
- Most common cause: the string was already partially escaped. If your input is "He said \\\"hi\\\"" and you escape again, you end up with double-escaped backslashes. Inspect the raw input character by character if you suspect mixed escaping.
- Is my data private?
- Yes. Everything runs locally — no upload, no log, no analytics on the text content.