How can I use DataContractJsonSerializer to parse a JSON array which does not have a fix name? Suppose a JSON Structure like this:
{
"SUMMARY":
{
"0123":
[
{
"Type": "Type_A",
"Duration": 100
}
]
}
}
In C#, I can initialise two data objects as below to parse them using DataContractJsonSerializer like this:
[DataContract]
public class numberedStruct {
[DataMember(Name = "Type")]
public string Type {get; set;}
[DataMember(Name = "Duration")]
public int Duration{get; set;}
}
[DataContract]
public class summaryStruct {
[DataMember(Name = "0123")]
public numberedStruct[] s;
}
However, what if "0123" is also a variable and it can be something else? So I cannot fix the DataMember name as "0123".
How can I get "0123" as an variable and also the content within the struct in C#?