GsonBuilder gb = new GsonBuilder(); gb.setDateFormat("yyyy-MM-dd HH:mm"); gb.registerTypeAdapter(Date.class, new JsonDeserializer() { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm"); @Override public Date deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { try { return df.parse(json.getAsString()); } catch (ParseException e) { return null; } } }); gb.registerTypeAdapter(Long.class, new JsonDeserializer () { @Override public Long deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { if (json.isJsonNull() || json.getAsString().length() == 0) { return null; } try { return json.getAsLong(); } catch (NumberFormatException e) { return null; } } }); gb.registerTypeAdapter(Integer.class, new JsonDeserializer () { @Override public Integer deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { if (json.isJsonNull() || json.getAsString().length() == 0) { return null; } try { return json.getAsInt(); } catch (NumberFormatException e) { return null; } } }); gson = gb.create();}