Gson to json conversion with two DateFormat
I was facing the same issue. Here is my solution via custom deserialization: new GsonBuilder().registerTypeAdapter(Date.class, new DateDeserializer()); private static final String[] DATE_FORMATS = new String[] { “MMM dd, yyyy HH:mm:ss”, “MMM dd, yyyy” }; private class DateDeserializer implements JsonDeserializer<Date> { @Override public Date deserialize(JsonElement jsonElement, Type typeOF, JsonDeserializationContext context) throws JsonParseException { for (String format … Read more