我推出了这段代码:
var responseSection = client.Execute<List<SectionResponse>>(requestSection);
我应该得到的回应:
[
{"SectionId":644852,"Name":"GDTC-MOBL-01-15W","Description":{"Text":"","Html":""},"Enrollments":[]},
{"SectionId":644853,"Name":"GDTC-MOBL-02-15W","Description":{"Text":"","Html":""},"Enrollments":[]}
]
我的数据类组:
public class SectionResponse
{
public List<SectionList> sectionList { get; set; }
}
public class SectionList
{
public int SectionId { get; set; }
public string Name { get; set; }
public Description_t Description { get; set; }
public List<Enrollments_t> Enrollments { get; set; }
}
public class Description_t
{
public string Text { get; set; }
public string Html { get; set; }
}
public class Enrollments_t
{
}
问题是它尝试两次(两个列表)但每个请求都返回null数据。 我该怎么做才能获得数据?
提前致谢,
菲利普
答案 0 :(得分:0)
你说你想要一个SectionResponse
的列表,它本身包含一个列表,所以基本上你说你想要一个列表列表,它与列表不匹配响应。
尝试以下方法:
var responseSection = client.Execute<SectionResponse>(requestSection);
或者这个:
var responseSection = client.Execute<List<SectionList>>(requestSection);