JSON原数据

{"total":1,"rows":[{"ID":1,"Title":"台州初级中学招收初一年级体育特长生的通告","Content":"",
"Type":"01","ReceiveUserName":"蔡婧怡","IsRead":0,"SendDate":"2014-07-18 15:21:40","SendUserName":"网站开发员"}]}

自定义model存放解析后的结果

public class MessageCenter {
private int ID;
private String Title;
private String Content;
private String Type;
private String ReceiveUserName;
private int IsRead;
private String SendDate;
private String SendUserName; public int getID() {
return ID;
}
public void setID(int iD) {
ID = iD;
}
public String getTitle() {
return Title;
}
public void setTitle(String title) {
Title = title;
}
public String getContent() {
return Content;
}
public void setContent(String content) {
Content = content;
}
public String getType() {
return Type;
}
public void setType(String type) {
Type = type;
}
public String getReceiveUserName() {
return ReceiveUserName;
}
public void setReceiveUserName(String receiveUserName) {
ReceiveUserName = receiveUserName;
} public int getIsRead() {
return IsRead;
}
public void setIsRead(int isRead) {
IsRead = isRead;
}
public String getSendDate() {
return SendDate;
}
public void setSendDate(String sendDate) {
SendDate = sendDate;
}
public String getSendUserName() {
return SendUserName;
}
public void setSendUserName(String sendUserName) {
SendUserName = sendUserName;
}
}
import java.util.List;

public class MessageCenterJsonBean {
private int total;
private List<MessageCenter> rows;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List<MessageCenter> getRows() {
return rows;
}
public void setRows(List<MessageCenter> rows) {
this.rows = rows;
}
}

解析JSON,resultString为JSON原数据

public static void main(String[] args) {
Gson gson = new Gson();
try {
MessageCenterJsonBean mcj= new GsonBuilder().create().fromJson(resultString, MessageCenterJsonBean.class);
System.out.println(mcj.getTotal());
} catch (Exception e) {
}
}

最新文章

  1. CommonJS, AMD 和 RequireJS之间的关系(转载)
  2. 对 Python 语法不够了解导致的 bug
  3. Meteor常用技能
  4. JSON 问题
  5. input file 在开发中遇到的问题 类似ajax form表单提交 input file中的文件
  6. 003.android资源文件剖析(Resources)
  7. Web API 2:Action的返回类型
  8. jquery背景动画插件使用
  9. Python使用心得之魔法参数**kw
  10. build.gradle代码
  11. SQL Server中表锁定的原理及解锁演示
  12. Saiku控制页面展示的数据过长自动换行(二十四)
  13. noteless的博客导航页 所有文章的导航页面
  14. Codeforces Round #495 (Div. 2) D. Sonya and Matrix
  15. Nginx(二)
  16. [转]Object.keys()和for in的排序问题
  17. 关于PCB的线宽与过孔
  18. 安装PyInstaller打包python
  19. [转]自定义Drawable实现灵动的红鲤鱼动画(上篇)
  20. sed正则

热门文章

  1. UVA - 12424 Answering Queries on a Tree(十棵线段树的树链剖分)
  2. [原创] 改善 Firemonkey Canvas 几何绘图质量问题(移动平台)
  3. Linux下开放指定端口
  4. Windows7系统安装TensorFlow深度学习框架全过程
  5. Centos故障01:Docker容器丢失
  6. QTP如何准确识别Dialog中的对象
  7. 【QTP专题】05_参数化之Excel
  8. vector妙用轻松水过平衡树???
  9. leetcode 42. 接雨水 JAVA
  10. ie7 a标签强制不换行兼容问题