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