I have this json:
[
{
"id": "89",
"name": "Italy",
"link": "https://int.soccerway.com/national/italy/a100/?ICID=SN_02_89",
"iso": "IT"
}
]
I'm trying to deserialize it with Newtonsoft.JSON
, so I created a class model:
public class Country
{
public string id { get; set; }
public string name { get; set; }
public string link { get; set; }
public string iso { get; set; }
}
and the deserialization:
var json = JsonConvert.DeserializeObject<Country>(content);
content contains the json above, anyway, this will return:
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'SWP.Models.Country' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
>(content);`
– Andrew Williamson May 21 '18 at 19:50