title: Default value for missing properties with JSON.net
body: <p>I'm using Json.net to serialize objects to database.</p>
  
  <p>I added a new property to the class (which is missing in the json in the database) and I want the new property to have a default value when missing in the json.</p>
  
  <p>I tried DefaultValue attribute but it's doesn't work. I'm using private setters and constructor to deserialize the json, so setting the value of the property in the constructor will not work as there is a parameter with the value.</p>
  
  <p>Following is an example:</p>
  
  <pre><code>    class Cat
      {
          public Cat(string name, int age)
          {
              Name = name;
              Age = age;
          }
  
          public string Name { get; private set; }
  
          [DefaultValue(5)]            
          public int Age { get; private set; }
      }
  
      static void Main(string[] args)
      {
          string json = "{\"name\":\"mmmm\"}";
  
          Cat cat = JsonConvert.DeserializeObject&lt;Cat&gt;(json);
  
          Console.WriteLine("{0} {1}", cat.Name, cat.Age);
      }
  </code></pre>
  
  <p>I expect the age to be 5 but it is zero.</p>
  
  <p>Any suggestions?</p>