我使用DataContractJsonSerializer进行 Json 解析。请告诉我如何解析这个json:
{"response":[2,{"mid":95001,"date":1360173495,"out":0,"uid":32578013,"read_state":0,"title":"Head","body":"message"}, {"mid":95000,"date":1360173439,"out":0,"uid":32506752,"read_state":0,"title":" Theme ","body":"message2"}]}
我不明白我需要什么结构。我正在尝试写这个:
[DataContract]
internal class Message
{
[DataMember]
public int IntMember { get; set; }
[DataMember]
public List<Messages> response { get; set; }
[DataContract]
protected internal struct Messages
{
[DataMember]
public string mid { get; set; }
[DataMember]
public string uid { get; set; }
[DataMember]
public string date { get; set; }
[DataMember]
public string title { get; set; }
[DataMember]
public string body { get; set; }
}
}
但这不起作用,因为一开始是 2。该怎么办?在解析之前删除这个数字,或者你可以直接忽略它?