title: Custom Json Serialization of class
body: <p>I have code structured like below.</p>
  
  <pre><code>public class Stats
  {
          public string URL { get; set; }
          public string Status { get; set; }
          public string Title { get; set; }
          public string Description { get; set; }
          public int Length { get; set; }
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code> public class UrlStats
   {
          public string URL { get; set; }
          public int TotalPagesFound { get; set; }
          public List&lt;Stats&gt; TotalPages { get; set; }
          public int TotalTitleTags { get; set; }
          public List&lt;Stats&gt; TotalTitles { get; set; }
          public int NoDuplicateTitleTags { get; set; }
          public List&lt;Stats&gt; DuplicateTitles { get; set; }
          public int NoOverlengthTitleTags { get; set; }
          public List&lt;Stats&gt; OverlengthTitles { get; set; }
   }
  </code></pre>
  
  <p>Basically i am scanning a website for statistics like title tags, duplicate titles, etc.</p>
  
  <p>I am using JQuery and making AJAX calls to webservice and retrieving url stats while the process is running to show user url stats by far collected since it takes quite a time to scan a big website. So after every 5 seconds i retrieve stats from server. Now the problem is all the List variable data i need to send at the end when scanning processing is complete, not during updates. What's happening right now the <code>List&lt;Stats&gt;</code> variable data is also sent during updates which is big chunk of data and i want to send only <code>int</code> type variables which are required to show process updates.</p>
  
  <p>From searching on internet i couldn't find anything useful solving my problem and i found that Json.NET is very good library but i really don't know how to properly use it to get what i want.</p>
  
  <p><strong>Basically i am looking for serializing properties depending on their datatype at runtime, if its possible.</strong></p>