I am using json file and trying to read using C#.
{
"Company": {
"ABC": {"ADDRESS" : "123 STREET",
"DEF" :"ADDRESS 567",
},
},
"Country": {
"Country1": "XYZ",
"Country2" : "ADG",
}
}
Here, I want to check ,if the leaf node value is retrieved,then execute a condition i.e Company-> ABC -> Address -> "123" So, 123 is leaf here.
Country -> Country1 -> "XYZ"
XYZ is leaf here .
string jsonFilePath = "D:\\ProjectCode1\\catalogJsonData.json";
string json = File.ReadAllText(jsonFilePath);
Dictionary<string, object> json_Dictionary = (new JavaScriptSerializer()).Deserialize<Dictionary<string, object>>(json);
foreach (var item in json_Dictionary)
{
// parse here
Console.WriteLine("{0} {1}", item.Value);
await context.PostAsync(item.Key);
}
Above code i am not getting any value printed for item.Value or item.Key

jsonisn't valid, it fails all RFC's;trailing commas present.jsonis not even valid. There are extra commas in couple places that make no sense. If that would be correct it be easy to parse using a class structure.