c# - Unable to extract values from object array, to which javascript array was deserialized -
var serializedarray = new javascriptserializer().deserialize<object[]>(filter); the content of variable filter [["title","contains","foo"],"and",["name","contains","foo"]].
content of serializedarray "object[3]","and","object[3]".
content of serializedarray[0] object[3] "title", "contains", "foo".
serializedarray can used index operator, , foreach applicable. not serializedarray[0].
funny enough, both serializedarray , serializedarray[0] have type of object[]. what's way grab value "title" or "name"?
var serializedarray = new javascriptserializer().deserialize<object[]>(filter); foreach (var item in serializedarray) { if (item string) { var element = item; } else foreach (var inneritem in (object[])item) { var element = inneritem; } }
Comments
Post a Comment