I'm using JavaScriptSerializer to deserialize a json into a class I made but I have a problem.
the json I'm trying to serialize is in this form. The form of the json is not in my control.
{"list": {
"p1": {
"a": 6,
"b": 7
},
"p2": {
"a": 1,
"b": 1
}
}
I'm trying to deserialize this into a class like this;
public class jsonObject
{
public listType list {get;set;}
internal class listType
{
}
}
and my deserialize method;
var engine = new JavaScriptSerializer();
dynamic foo = engine.Deserialize<jsonObject>(json);
What I can't figure out what to do with the items inside the list. It's not an array and the number of objects inside it can vary. It would sometimes be just p1, and it would sometimes go until p7. Is there a solution to this other than declaring p1,p2,p3,p4,p5,p6,p7 inside my listType?