我正在使用 Facebook 图形 API 来搜索页面,https://graph.facebook.com/search?q=platform&type= page
这是json中的响应,我只包括了一个:
{
"data": [
{
"category": "Media/news/publishing",
"category_list": [
{
"id": "108366235907857",
"name": "Newspaper"
}
],
"name": "Arab News",
"id": "10250877124"
}
],
"paging": {
"next": "https://graph.facebook.com/search?limit=1&offset=1&type=page&q=media&__after_id=10250877124"
}
}
现在,这是我在 C# 中的类:
public class CategoryList
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
}
public class DataRoot
{
[JsonProperty("category")]
public string Category { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("category_list")]
public CategoryList[] CategoryList { get; set; }
}
public class Paging
{
[JsonProperty("next")]
public string Next { get; set; }
}
public class FacebookPageResults
{
[JsonProperty("data")]
public DataRoot[] Data { get; set; }
[JsonProperty("paging")]
public Paging Paging { get; set; }
}
这是奇怪的事情,当我尝试反序列化它时
FacebookPageResults response = new JavaScriptSerializer().Deserialize<FacebookPageResults>(res);
,CategoryList 始终为空,甚至没有填满。我试过 List CategoryList {get; set;} 但结果是一样的吗?
关于此的任何帮助或解决方法