I have a class like this
public class RootObject
{
public List<Award> award { get; set; }
}
public class Award
{
public string name { get; set; }
public string year { get; set; }
}
Json award
"[{\"name\":\"Student of the month\",\"year\":\"2017-01-01\"},
{\"name\":\"National Hero\",\"year\":\"2017-01-01\"}]"
I deserialize like this
var awardList = JsonConvert.DeserializeObject<RootObject>(award)
foreach (var item in awardList.award)
{
Profile.Awards.Add(item);
}
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type. What's wrong in this code?