enter image description here I tried to get the value of an object[] but using foreach didn't work well. object[] contains a list of object[] how can I fetch the data
public void SaveBottonTable(string dimension)
{
JavaScriptSerializer json_serializer = new JavaScriptSerializer();
object[] routes_list =
(object[])json_serializer.DeserializeObject(dimension);
GlobalConstant.holeconfiguration = routes_list;//list is referred in the image
foreach(object hole in routes_list)
{
hole[0]//shows error
}
}
how to get the value of the first object[]
https://i.sstatic.net/x8SG1.png
object holerepresents single object. when you dohole[0]you are trying to use single object as array of objects. That's why you are getting an error. You should dovar routes = hole as object[];in foreach loop an then you can access individual objects fromroutesby doingroutes[0],routes[1]etc..