Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1
To make it clear, in addition to @SLaks' answer, that meant you need to change this line :
List<RootObject> datalist = JsonConvert.DeserializeObject<List<RootObject>>(jsonstring);
to something like this :
RootObject datalist = JsonConvert.DeserializeObject<RootObject>(jsonstring);
That happened to me too, because I was trying to get an IEnumerable
but the response had a single value. Please try to make sure it's a list of data in your response. The lines I used (for api url get) to solve the problem are like these:
HttpResponseMessage response = await client.GetAsync("api/yourUrl");if (response.IsSuccessStatusCode){ IEnumerable<RootObject> rootObjects = awaitresponse.Content.ReadAsAsync<IEnumerable<RootObject>>(); foreach (var rootObject in rootObjects) { Console.WriteLine( "{0}\t${1}\t{2}", rootObject.Data1, rootObject.Data2, rootObject.Data3); } Console.ReadLine();}
Hope It helps.