I have below JSON file under service map, The Key values are not fixed
{
"ServiceMap": {
"rackAC1": {
"Env": "Public",
"Center": "north"
},
"rackD1": {
"Env": "Public",
"Center": "south"
},
"rackD2": {
"Env": "Public",
"Center": "North-south"
},
"rackD3": {
"Env": "Public",
"Center": "south"
},
...,
"rackD1000": {
"Env": "Public",
"Center": "south"
},
"rackBO": {
"Env": "Public",
"Center": "East"
},
"rackB1": {
"Env": "Public",
"Center": "West"
}
}
}
I want to extract the key values from rackD1 to rackD1000 whose center is south using linq.
is it possible to extract the key value like JsonContent["serviceMap"][rackD1*]
2
Answers
Just deserialize it to proper class structure and use LINQ on the results.
And filter results:
you dont need any classes to get list of keys