Populate ComboBox from JSON Object
Hello, I have below Json [ { "customerid": 1, "name": "ABS", "email": "true", "reference": "2016-03-21T10:44:32+03:00", "status": 0, "dateupdated": "2017-12-07T04:56:05.583" }, { "customerid": 2, "name": "BMS", "email": "true", "reference": "2016-03-13T19:17:54+03:00", "status": 0, "dateupdated": "2017-12-07T04:56:05.757" }, { "customerid": 3, "name": "XYA", "email": "true", "reference": "2016-03-13T19:17:54+03:00", "status": 0, "dateupdated": "2017-12-07T04:56:05.757" } ] In my windows form I create class API.cs class API { } public class RootObject { public int customerid { get; set; } public string name { get; set; } public string email { get; set; } public DateTime reference { get; set; } public int status { get; set; } public DateTime dateupdated { get; set; } } I need to populate combo box customer_cb with "name" I use DataContractJsonSerializer WebClient client = new WebClient(); string json = client.DownloadString(url); using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(json))) { DataContractJsonSerializer deserializer = new DataContractJsonSerializer(typeof(RootObject)); RootObject obj = (RootObject)deserializer.ReadObject(ms); // Assign data to combo box foreach(var name in obj.name) { ComboboxItem item = new ComboboxItem(); item.Text = name.ToString(); customer_cb.Items.Add(item); } } When I run I get error "Object Reference not set to an instance of an object" Please help