The coding blog of Alastair Smith, a software developer based in Cambridge, UK. Interested in DevOps, Azure, Kubernetes, .NET Core, and VueJS.
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:
[gist:1152445]
It wasn’t obvious how to do this, for some reason - I spent a while investigating the JsonReader
and JsonWriter
classes to no avail.
Hope this helps you too!