I am using Json.NET to deserialize the following JSON:
[
{
"id": 1234,
"name": "Example",
"coords": "[12:34]",
"relationship": "ownCity"
},
{
"id": 53,
"name": "Another example",
"coords": "[98:76]",
"relationship": "ownCity"
}
]
I'm trying to parse it to a List.
List<City> cities = JsonConvert.DeserializeObject<List<City>>(json);
The definiton of the City class:
public class City
{
int id { get; set; }
string name { get; set; }
string coords { get; set; }
string relationship { get; set; }
}
The result is a list of two City objects, but all of their properties are null (id is 0).
Could anyone give me a heads up what I'm doing wrong? Thanks in advance.