I've got a JSON as following
{"name1":20,"name2":22}
My aim is to save it in a List of People so that it can be used afterwards, so I first wrote the class People:
class People
{
public String name{get;set;}
public long age{get;set;}
}
I wrote as long as to prevent this deserializing errors.
Then I wrote the following code:
String json= new System.Net.WebClient().DownloadString(url);
List<People> people= JsonConvert.DeserializeObject<List<People>>(json);
But it gets stuck at processing this last line (no errors / no crash ..), why?
I think your Json should look more like this if you want to deserialize to List
[{"name":"Name1","age":20},{"name":"Name2","age":22}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With