How JSON string escaping works
A JSON string is a single JSON value wrapped in double quotes. Inside that value, certain characters need escape sequences: double quotes become \", backslashes become \\, newlines become \n, tabs become \t, and carriage returns become \r.
This page uses JSON.stringify in encode mode, so the output is a complete quoted string literal. Decode mode uses JSON.parse, which means normal string input should include surrounding double quotes and valid escape sequences.
JSON string escaping is not the same as formatting or validating a whole JSON object. If you are working with complete documents, nested arrays, sorted keys, or structural errors, move to the JSON Formatter or JSON Validator instead.