參考 http://blog.csdn.net/lk_blog/article/details/7685190 json
知足本身的特殊需求 ide
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class,new JsonSerializer<Date>(){
@Override
public JsonElement serialize(Date date,Type type, ui
JsonSerializationContext jsonSerializationContext) { spa
return new JsonPrimitive(date==null?0:date.getTime());
}
});
builder.create().toJson(map); .net