title: How to deserialize JSON to a nested class using JSON.net?
body: <p>I have JSON:</p>
  
  <pre><code>{"customer":[{"phone":"9868133331"},{"phone":"9971714514"}],"message":[{"type":"reminder"},{"type":"reminder"}]}
  </code></pre>
  
  <p>Which is formatted as:</p>
  
  <pre><code>{
    "customer": [
      {
        "phone": "9868133331"
      },
      {
        "phone": "9971714514"
      }
    ],
    "message": [
      {
        "type": "reminder"
      },
      {
        "type": "reminder"
      }
    ]
  }
  </code></pre>
  
  <p>I am trying to map JSON in a nested class:</p>
  
  <pre><code>public class AllData
  {
      public class Message
      {
          public String Type;
      }
  
      public class Customer
      {
          public String Phone;
      }
  
      public List&lt;Message&gt; Messages = new List&lt;Message&gt;();
      public List&lt;Customer&gt; Customers = new List&lt;Customer&gt;();
  }
  </code></pre>
  
  <p>with code:</p>
  
  <pre><code>AllData Data = new AllData();
  Data = Newtonsoft.Json.JsonConvert.DeserializeObject&lt;AllData&gt;(JSON);
  </code></pre>
  
  <p>But it gives me empty List of <code>Data.Customers</code> and <code>Data.Messages</code>. The code does not populate the data from JSON to my objects of type List. I mean <code>Data.Customers.Count</code> and <code>Data.Messages.Count</code> is equal to <code>0</code></p>