I am new on json in C#. I use newtonsoft.json I have a json file with data (array):
[
{
"firstName": "Joyce",
"lastName": "Huff",
"isActive": true,
"age": 59,
"gender": "female",
"eyeColor": "green",
"friends": [
"Kendra Buck"
]
},
{
"firstName": "Diann",
"lastName": "Patrick",
"isActive": true,
"age": 45,
"gender": "female",
"eyeColor": "blue",
"friends": [
"Roach Mills",
"Diaz Pickett"
]
},
{
"firstName": "Holt",
"lastName": "Erickson",
"isActive": false,
"age": 53,
"gender": "male",
"eyeColor": "brown",
"friends": [
"Lindsay Wyatt",
"Freeman Mcfadden",
"Matilda Franklin"
]
},
{
"firstName": "Crystal",
"lastName": "Santiago",
"isActive": false,
"age": 31,
"gender": "female",
"eyeColor": "brown",
"friends": [
"Stacy Joseph"
]
}
]
How to I read a json file containing array with C# and perform LINQ query on it? I found example on JObject to read json from file but I could not figure it out how do I handle json array. After reading json array, I would like to run query like: select count(*) from person where age>40;
Please suggest me. Thank you in advance.