An escaped stack trace
Input
Error: failed\n at run (app.js:10)\n at main (app.js:20)Output
Error: failed
at run (app.js:10)
at main (app.js:20)The \n sequences become real line breaks, making the trace readable.
Unescaping expands the backslash sequences in a JSON string back into the characters they represent, turning a single unreadable line into the multi-line text it encodes.
This is what you need when a log entry, an error message or a certificate has been stored as a JSON string and you want to read it, particularly for stack traces, where the content is meaningless until the \n sequences become real line breaks.
Each example below is executed against this tool by the test suite, so what you see is what the tool actually produces.
Input
Error: failed\n at run (app.js:10)\n at main (app.js:20)Output
Error: failed
at run (app.js:10)
at main (app.js:20)The \n sequences become real line breaks, making the trace readable.
The details that decide whether a conversion is correct, and where information can be lost without any error being raised.
Turn arbitrary text into a valid JSON string value.
Indent and beautify JSON, with syntax error locations when available.
Turn \u escape sequences back into characters.
Turn HTML entities back into readable characters.