views:

14

answers:

0

I'm using JSON.NET as a quick and dirty way of serializing an object to a string. It is being used as part of a logging framework, which means the output will need to be as human readable as possible.

JSON.NET is good in that we can turn on Formatting.Indented for human readability, but say the StackTrace property inside an Exception. Inside that string, the whitespace is replaced with escaped character sequences. A stacktrace is impossible to read if it's all on one line!

Is there a simple way to prevent this without parsing the string again and replacing the escape characters with their original whitespace?