我试图用GSON解析以下JSON响应:
{
"total": 15,
"page": 2,
"pagesize": 10,
"rep_changes": [
{
"user_id": 2341,
"post_id": 2952530,
"post_type": "question",
"title": "unprotected access to member in property get",
"positive_rep": 5,
"negative_rep": 0,
"on_date": 1275419872
},
{
"user_id": 2341,
"post_id": 562948,
"post_type": "question",
"title": "Do you have any recommendations on Blend/XAML books/tutorials for designers?",
"positive_rep": 20,
"negative_rep": 0,
"on_date": 1270760339
}
....
}
Run Code Online (Sandbox Code Playgroud)
这些是我定义的两个类(每个类包含相应的getter和setter):
public class Reputation {
private int total;
private int page;
private int pagesize;
private List<RepChanges> rep_changes;
public class RepChanges { …Run Code Online (Sandbox Code Playgroud)