I have a sample json like this :
{"'1234xxxxxx'":[{"AttributeId":"1","AttributeName":"Brand","AttributeValue":""},{"AttributeId":"2","AttributeName":"Color","AttributeValue":"Red4"},{"AttributeId":"3","AttributeName":"Size","AttributeValue":"44"},{"AttributeId":"4","AttributeName":"Resolution","AttributeValue":"Full HD"}]}
I have created a sample DataContract class like this :
[System.Runtime.Serialization.DataContract]
public class Rootobject
{
[System.Runtime.Serialization.DataMember]
public attr[] attrs { get; set; }
}
[System.Runtime.Serialization.DataContract]
public class attr
{
[System.Runtime.Serialization.DataMember]
public string AttributeId { get; set; }
[System.Runtime.Serialization.DataMember]
public string AttributeName { get; set; }
[System.Runtime.Serialization.DataMember]
public string AttributeValue { get; set; }
}
Now , I want to access the attributes using DataContractJsonSerializer and memorystream, but the problem is that the key '1234xxxxxx' in my json is dynamically generated everytime. So how should I access the attributes in my c# code?