consider the following json file
{
"test": {
"CR": {
"name": "Car"
},
"BK": {
"name": "Bike"
}
}
How can i combine usage of anonymous types with LINQ to JSON for creating key-value pairs of
CR Car
BK Bike
by using LINQ to JSON?
I have tried something as simple as the following for start, but it does not even compile
JObject o = JObject.Parse(s);
var pairs = o["test"].Select(x => x.Value).ToList();
To be more precise something like this pseudocode
var pairs = o["test"].Select( new { key = x => x.firstOrDefault().Name, value = x => x.Value}).ToList();