Java bean: package com.jingle.a; public class Person { public String name; public int age; public Person (){ } public Person(String name, int age) { super(); this.name = name; this.age = age; } public String toString() { return "Person [name=" +
有时候我们希望gson按照我们想要的方式转换,比如将日期转换为时间戳 class GsonBuilderUtil { public static Gson create() { GsonBuilder gb = new GsonBuilder(); gb.registerTypeAdapter(java.util.Date.class, new DateSerializer()).setDateFormat(DateFormat.LONG); Gson gson = gb.create(); r