Top area is raw text; bottom is JSON.stringify output. Decode runs JSON.parse on the bottom box.
JSON.stringify is the safest way to escape JavaScript string content.
"Line1\nTab\there \"quote\""
Decode runs JSON.parse on the bottom field; it must be valid JSON.