I want to access key from value. and I am able to access value from key. My json file look as
{
"screen": {
"0": "42x11",
"1": "16x16",
"2": "40x30",
"3": "32x32",
"4": "42x32",
"5": "48x32",
"6": "60x40",
"7": "150x40",
"8": "84x48"
},
"os": {
"0": {
"versions": {
"1": {
"name": "10"
},
"2": {
"name": "8"
},
"3": {
"name": "7"
}
},
"name": "Windows"
}
},
"app": {
"1": {
"name": "javaScript1",
"versions": {
"1": {
"name": "1.0"
}
}
}
}
}
I have parsed the file with the help of JavaScriptSerializer as.
public void deserialize_metadata()
{
using (StreamReader r = new StreamReader("C:\\Users\\vikash.kumar\\Desktop\\metadatainfo.json"))
{
var json = r.ReadToEnd();
var jss = new JavaScriptSerializer();
var dict = jss.Deserialize<Dictionary<string, dynamic>>(json);
Console.WriteLine("dict" + dict["screen"]["0"]); //o/p - 42x11
Console.WriteLine("dict" + dict["app"]["1"]["name"]); //o/p - javaScript1
}
}
It works fine when we want to access value from key.
How we can access key from value by this process?