Json Pretty Printer/Beautifier Library For .Net

In the current project I'm working on, I need to create a lot of configuration/data files for when the application builds the database (Fluent-Nhibernate). This appears necessary because the application must populate the database with some default mostly static domain objects that are required for the application to begin working normally.

The two main .net json Beautifiers were Jayrock, and the C# source code of a "quick and dirty" json pretty printer by Raymond Glover . I actually like Raymond's a little better, because Jayrock is more of a general purpose Json library rather than being focused on pretty printing.

Raymond's was cool, but I wanted one that would conform exactly to a specific json beautifier JsonLint . Seeing how short and easy it was for Raymond, I decided to write my own json beautifier/pretty printer and wire it up to my blog. I think I mostly wanted an excuse to use the strategy pattern in a situation where it appeared to be needed.

You can download the library using Nuget (Nuget Project Page) or you can get the source code here. [223k, zip]

You can use the pretty printer object or just the extension methods I've provided. I've included json and/or beautifing extension methods, for ease of use.


First posted on 4/16/2010 6:47:00 PM