Android Gson解析例項
阿新 • • 發佈:2019-02-13
Gson解析要點:
1、內部巢狀的類必須是static的,要不然解析會出錯;
2、類裡面的屬性名必須跟Json欄位裡面的Key是一模一樣的;
Json格式:
{
"content":{
"identity":"8840e0f067cd11e89485ed92ccd5da27",
"hints":{
"level":"SUCCESS",
"tips":{
}
},
"context":{
},
"content":{
"balance ":"52.42"
}
}
}
java實體類:
public class VipBalanceBean {
public ContentBean content;
public static class ContentBean {
public String identity;
public Hints hints;
public Context context;
public Content1 content;
public static class Hints {
public String level;
public Tips tips;
public static class Tips {
}
}
public static class Context {
}
public static class Content1 {
public String balance;
}
}
}