<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html">Mark Rogers</title>
  <icon>http://www.markdavidrogers.com/oxitesample/Content/icons/flame.ico</icon>
  <logo>http://www.markdavidrogers.com/oxitesample/Content/icons/flame.png</logo>
  <updated>2010-04-16T18:47:00Z</updated>
  <subtitle type="html">This is the Oxite Sample description</subtitle>
  <id>http://www.markdavidrogers.com/oxitesample/atom</id>
  <link rel="alternate" type="text/html" hreflang="en" href="/oxitesample/"/>
  <link rel="self" type="application/atom+xml" href="http://www.markdavidrogers.com/oxitesample/ATOM"/>
  <generator uri="http://oxite.net" version="1.0">Oxite</generator>
  <entry>
    <title type="html">Json Pretty Printer/Beautifier Library For .Net</title>
    <link rel="alternate" type="text/html" href="http://www.markdavidrogers.com/oxitesample/Blog/json-pretty-printerbeautifier-library-for-net"/>
    <id>http://www.markdavidrogers.com/oxitesample/Blog/json-pretty-printerbeautifier-library-for-net</id>
    <updated>2010-04-17T06:06:35.627Z</updated>
    <published>2010-04-16T18:47:00Z</published>
    <author>
      <name>Admin</name>
    </author>
    <category term=".net" />
    <category term="beautify" />
    <category term="json" />
    <content type="html" xml:lang="en">
      &lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;  The two main .net json Beautifiers were &lt;a href=&quot;http://jayrock.berlios.de/&quot;&gt;Jayrock&lt;/a&gt;, and the C# source code of a &quot;quick and dirty&quot; json pretty printer &lt;a href=&quot;http://weblog.cynosura.eu/post/2010/03/06/Json-Pretty-Printer.aspx&quot;&gt; by Raymond Glover &lt;/a&gt;.  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. &lt;/p&gt;
&lt;p&gt; Raymond's was cool, but I wanted one that would conform exactly to a specific json beautifier &lt;a href=&quot;http://www.jsonlint.com/&quot;&gt; JsonLint &lt;/a&gt;.   Seeing how short and easy it was for Raymond, I decide 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.
&lt;/p&gt;
&lt;p&gt;&lt;textarea id=&quot;json-text&quot; cols=&quot;80&quot; rows=&quot;10&quot; wrap=&quot;off&quot;&gt;&lt;/textarea&gt;&lt;/p&gt;
&lt;p&gt;&lt;button id=&quot;beautify-json-button&quot;&gt;Beautify Json&lt;/button&gt; &lt;/p&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
      $(document).ready(function() {
          $(&quot;#beautify-json-button&quot;).click( function () {
	 	 var inputJson = $('#json-text').val();	 
	      		$.post(&quot;/oxitesample/JsonPrettyPrinter/BeautifyJson&quot;,
	 	 	     { &quot;unprettyJson&quot; : inputJson },
			     function(data){
						$('#json-text').val(data);
        	 	 }, &quot;json&quot;);
	 });
      });
 &lt;/script&gt;
&lt;p&gt;&lt;a href=&quot;http://www.markdavidrogers.com/files/JsonPrettyPrinterPlus.dll&quot;&gt;You can download the DLL here (using .net framework 3.5). [10k]&lt;/a&gt; or the &lt;a href=&quot;http://www.markdavidrogers.com/files/JsonPrettyPrinterPlus.zip&quot;&gt;source code here. [223k, zip]&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
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.&lt;/p&gt;
    </content>
  </entry>
</feed>
