Multi-line text with a quote
Input
Line one
He said "hi" doneOutput
Line one\nHe said \"hi\"\tdoneThe newline, quotes and tab all become escape sequences, so the text fits on one line as a JSON string.
JSON strings cannot contain a raw newline, tab, double quote or control character. Escaping converts each into its backslash sequence so the text becomes a legal JSON string value.
The most common need is embedding something multi-line into JSON by hand: a certificate, a private key, a SQL query or a log excerpt that has to become one field in a request body or a config file.
Each example below is executed against this tool by the test suite, so what you see is what the tool actually produces.
Input
Line one
He said "hi" doneOutput
Line one\nHe said \"hi\"\tdoneThe newline, quotes and tab all become escape sequences, so the text fits on one line as a JSON string.
The details that decide whether a conversion is correct, and where information can be lost without any error being raised.
Turn an escaped JSON string back into readable text.
Indent and beautify JSON, with syntax error locations when available.
Turn characters into \u escape sequences.
Escape <, >, &, and quotes for safe HTML display.