title: Deserializing a heterogeneous JSON array using Json.NET
body: <p>I have been searching for days, hours at a time trying to find an answer to my question.  I have the following JSON string:</p>
  
  <pre><code>{
      "id":   "658@787.000a35000122",
      "take": [{
              "level":    [0],
              "status":   [[3, [0]]]
          }]
  }
  </code></pre>
  
  <p>That is a sample of a variety of messages that I need to deserialize, but it is the one that is causing me heartache right now.  The problematic portion for me is the "status" array.  My class to accept the results of deserializing the string is:</p>
  
  <pre><code>    [DataContract]
      public class ReceivedMsg
      {
          public ReceivedMsg()
          {
              move = new List&lt;MoveOperation&gt;();
          }
  
          [DataMember]
          public string id { get; set; }
  
          [DataMember]
          public List&lt;MoveOperation&gt; move { get; set; }
  
          [DataContract]
          public class Status
          {
              [DataMember]
              public int destination { get; set; }
  
              [DataMember]
              public int[] source { get; set; }
          }
  
          [DataContract]
          public class MoveOperation
          {
              public MoveOperation()
              {
                  status = new List&lt;Status&gt;();
              }
  
              [DataMember]
              public int[] level;
  
              [DataMember]
              public List&lt;Status&gt; status { get; set; }
          }
      }
  </code></pre>
  
  <p>The code to do the deserializing is:</p>
  
  <pre><code>ReceivedMsg m = new ReceivedMsg();
  
  m = JsonConvert.DeserializeObject&lt;ReceivedMsg&gt;(strResp, new JsonSerializerSettings { TraceWriter = traceWriter });
  </code></pre>
  
  <p>Where strResp is the string containg the JSON data.</p>
  
  <p>I initially tried using the JSON library that is a part of the .NET framework, but got stuck on the "status" portion.  That's what prompted me to try Json.NET.</p>
  
  <p>The error I am getting is:</p>
  
  <pre><code>An unhandled exception of type 'Newtonsoft.Json.JsonSerializationException' occurred in Newtonsoft.Json.dll
  
  Additional information: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Roper.Roper+ReceivedMsg+Status' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
  
  To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List&lt;T&gt; that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
  
  Path 'move[0].status[0]', line 6, position 16.
  </code></pre>
  
  <p>Any help would be greatly appreciated.  Of course I will be happy to furnish additional information as needed.  I tried doing a custom converter, but I think my C# knowledge is not quite at that level yet.  I have been trying to decipher the solutions offered in answer to similar questions, but concluded that I must be missing something.</p>
  
  <p>My sincere thanks to the community for taking the time to read my lengthy question.  Your generosity continues to amaze me!</p>