I have some json like this:
[{
"id": "20148324",
"teacher", "Mr Jones",
"names": ["john", "bill", "ben"],
"priority": 2
},
{
"id": "56128324",
"teacher", "Mrs Jones"
"names": ["john", "bill", "ben"],
"priority": 1
}]
I want to be able to first select the child which has a priority value of 1, then in that child i want to select the last name in the nested names array.
I can accomplish this in two steps but was wondering how i can do it with one linq statement.
This is what i have got so far but i only get one dictionary item added. How can i add all the names individually with the teacher name to the dictionary:
var things = response.Where(p => p["priority"].Value<int>() == 1)
.ToDictionary(m => m["teacher"].ToString(),
m => m["names"].Children().ToString());
Eventually did it with this. Not convinced its the nicest way, but it works.