title: Deserializing an empty array using Json.NET
body: <p>I've got a C# application that uses Json.NET v7.0.1.  As a result of a REST call, I get back some JSON in the form of:</p>
  
  <pre><code>{
  "messages": [ {"phoneNumber":"123-456-7890", "smsText":"abcd1234="},
                {"phoneNumber":"234-567-8901", "smsText":"efgh5678="},
                {"phoneNumber":"345-678-9012", "smsText":"12345asdf"} ]
  }
  </code></pre>
  
  <p>If there is no message data to return, the JSON that I get back looks like this:</p>
  
  <pre><code>{
  "messages": [ ]
  }
  </code></pre>
  
  <p>My Message class looks like this:</p>
  
  <pre><code>public class Message
  {
      public string PhoneNumber { get; set; }
      public string SmsText { get; set; }
  
      public Message()
      {
      }
  
      public Message(string phoneNumber, string smsText)
      {
          PhoneNumber = phoneNumber;
          SmsText = smsText;
      }
  }
  </code></pre>
  
  <p>When I try to deserialize the JSON, I'm using the following code:</p>
  
  <pre><code>Message[] messages = JsonConvert.DeserializeObject&lt;Message[]&gt;(json, new JsonSerializerSettings
  {
      MissingMemberHandling = MissingMemberHandling.Ignore
  });
  </code></pre>
  
  <p>The problem I'm running into is deserializing the JSON when the messages array is empty.  When that occurs, I get the following exception:</p>
  
  <blockquote>
    <p>Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"})
    into type 'WindowsFormTestApplication.Message[]' because the type
    requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo
    fix this error either change the JSON to a JSON array (e.g. [1,2,3])
    or change the deserialized type so that it is a normal .NET type (e.g.
    not a primitive type like integer, not a collection type like an array
    or List) that can be deserialized from a JSON object.
    JsonObjectAttribute can also be added to the type to force it to
    deserialize from a JSON object.
         Path 'messages', line 2, position 15.</p>
  </blockquote>
  
  <p>When the JSON array is empty, I'd like my Message[] variable to be null.  Do I need a custom converter to get this deserialized or am I missing something obvious?  Thanks!</p>