I was struggling to find a way to pretty-print a JSON string in .NET. I already have the excellent Json.NET package available and after a bit of hunting, I came up with this:
It wasn’t obvious how to do this, for some reason - I spent a while investigating the
JsonWriter classes to no avail.
Hope this helps you too!