Convert plain text into a JSON-safe string, or recover the original text.
Escape mode wraps the text in quotes and encodes quotes, backslashes, newlines and control characters. Unescape reverses the process.