参考 http://blog.csdn.net/lk\_blog/article/details/7685190
满足自己的特殊需求
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class,new JsonSerializer
@Override
public JsonElement serialize(Date date,Type type,
JsonSerializationContext jsonSerializationContext) {
return new JsonPrimitive(date==null?0:date.getTime());
}
});
builder.create().toJson(map);