按栏目快速找到需要的在线工具。
JSON 解析、格式化、压缩、对比与实体生成。
Base64、URL、进制、哈希与 AES 加密工具。
DNS、SEO、HTTP、robots 与站点检查。
日期、计算器、健康与便民工具。
前端、编程、数据库与服务器教程。
11 个工具栏目,按使用场景分类。
日期:2014-05-16 浏览次数:20774 次
Gson 是 Google 提供的用来在 Java 对象和 JSON 数据之间进行映射的 Java 类库。可以将一个 JSON 字符串转成一个 Java 对象,或者反过来。
jar和源码下载地址: http://code.google.com/p/google-gson/downloads/list
实体类:
public class Student { private int id; private String name; private Date birthDay; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getBirthDay() { return birthDay; } public void setBirthDay(Date birthDay) { this.birthDay = birthDay; } @Override public String toString() { return "Student [birthDay=" + birthDay + ", id=" + id + ", name=" + name + "]"; } }