JsonConvert.DeserializeObject <列表<登记>&GT;总是返回10个结果

时间:2017-03-20 16:06:15

标签: c# json.net

我的JsonConvert.DeserializeObject&gt;正在工作,但最多只返回10个结果。我知道我在API中获取的数据项有24条记录,但只返回10条记录。

这是JSON:

    [
{
"id":2227,
"user_id":441,
"grades":
    {"html_url":"https://...",
    "current_score":91.26,
    "current_grade":null,
    },
"sis_account_id":"11",
"user":
    {"id":441,
     "name":"Nicholas Bailey",
    }
},

以下是课程:

        public class Grade
{
    public string html_url { get; set; }
    public decimal? current_score { get; set; }
    public string current_grade { get; set; }
}
public class User
{
    public int? id { get; set; }
    public string name { get; set; }
}
public class Enrollment
{
    public int? id { get; set; }
    public int? user_id { get; set; }
    public Grade grades { get; set; }
    public string sis_account_id { get; set; }
    public User user { get; set; }
}

这是我的代码:

  HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://(some uri)");

    WebResponse response = request.GetResponse();

    StreamReader sr = new StreamReader(response.GetResponseStream());

    string content = sr.ReadToEnd();

    JsonSerializerSettings settings = new JsonSerializerSettings();
    settings.MetadataPropertyHandling = MetadataPropertyHandling.Ignore;

    var outObject = JsonConvert.DeserializeObject<List<Enrollment>>(content, settings);

我想知道JsonSerializerSettings中是否有一个控制它的属性。我搜索谷歌但找不到任何东西。请帮忙。感谢。

1 个答案:

答案 0 :(得分:0)

你检查过api有分页功能吗?也许api方面有一个页面参数?