serialize

Pretty-printing JSON with Json.NET

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 JsonReader and JsonWriter classes to no avail.

Hope this helps you too!

Subscribe to RSS - serialize