When you embed arbitrary text inside a JSON string, certain characters must be escaped or the JSON becomes invalid. This tool escapes text into a spec-correct JSON string body and unescapes it back, so you can move data in and out cleanly.
How it works
Escaping applies the JSON string rules in order. The backslash and double quote
get short escapes, the common control characters get their named escapes, and any
other control character becomes a \uXXXX sequence:
\ -> \\ " -> \"
newline -> \n tab -> \t carriage return -> \r
backspace -> \b form feed -> \f
other controls (< U+0020) -> \u00XX
Unescaping reverses this: it reads each backslash sequence, expands the known
escapes and \uXXXX references, and rejects malformed escapes with an error.
Tips and notes
The backslash must be escaped before the quote, or you would double-escape an
already-escaped quote. The forward slash never needs escaping in JSON, so it is
left alone by default; turn on slash-escaping only when embedding JSON inside an
HTML script tag, where </ could otherwise close the tag early. For pure-ASCII
output across systems with shaky encoding, enable the ASCII-safe option to emit
every non-ASCII character as \uXXXX.