I have a class in the format:
public class Person
{
public string Name {get;set;}
public int Age {get;set;}
public string Car {get;set;}
}
What i tried to read the JSON from a file:
using (StreamReader r = new StreamReader(path))
{
string json = r.ReadToEnd();
//var items = JsonConvert.DeserializeObject<IEnumerable<Person>>(json);
}
When I got the JSON in a string I got that in the format below:
[
["John", 30, "BMW"],
["Tim", 45, "Ford"],
["Kim", 34, "Toyota"]
]
I thought that JSON would be Deserialize in that IEnumerable<Person>
, but it couldn't.
What is the correct way to deserialize the JSON string with that Person
class?