title: Json.NET, Unable to de-serialize nullable type
body: <p>I'm trying to convert JSON to C# object using Json.NET.  The object looks like this in C#:</p>
  
  <pre><code>public class MyObject 
  {
     public int? integerValue {get;set;}
     public DateTime? dateTimeValue {get;set;}
  }
  </code></pre>
  
  <p>But when I run <code>JsonConvert.DeserializeObject()</code> on the incoming JSON, I get the following Exception:</p>
  
  <blockquote>
    <p>Unable to find a constructor to use
    for type
    System.Nullable`1[System.Int32]. A
    class should either have a default
    constructor or only one constructor
    with arguments.</p>
  </blockquote>
  
  <p>--- EDIT  ----</p>
  
  <p>Well it turns out that after doing many tests, the problem boils down to that my input for my JSON was like this:</p>
  
  <pre><code>{integerValue:{}, dateTimeValue: {} }
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>{integerValue: null, dateTimeValue: null}
  </code></pre>
  
  <p>It turns out that the  {}  is a valid way of representing a null object in JSON but the JSON.Net parser did not know to treat {} tokens the same way as 'null' when de-serializing.</p>
  
  <p>Thanks everyone for your input!</p>