JSON:
{
"o-data":[
{
"entry 1":"test1",
"entry 2":"test2",
"entry 3":"test3",
"entry 4":"118"
}
]
}
C#:
dynamic dn = dyndata(json);
foreach (KeyValuePair<string, object> kvp in dn)
{
//I would like to be able to get all the inner data for `o-data` like below...
string entry1 = "";// test1
string entry2 = "";// test2
string entry3 = "";// test3
//but instead I get `{[o-data, System.Object[]]}`
string second = kvp.Value.ToString(); // gives my 'System.Object[]'
}
public dynamic dyndata(string json)
{
dynamic dyn1 = new System.Dynamic.ExpandoObject();
try
{
var serializer = new JavaScriptSerializer();
var result = serializer.DeserializeObject(json);
return result);
}
catch { return Tuple.Create(dDummy, false); }
}
How can I the KVP of the inner list for 'o-data'.
Currently it only loop once because of o-data. I would like to get the inner list of o-data and loop through that.