Where did I do wrong? debugging causes the following: module.addDeserializer static class JsonDeserializer mapper.registerModule (module) return mapper;
Inside static class JsonDeserializer does not want to do anything .....
public class MyJsonWrapper { public static ObjectMapper getMyJson() { ObjectMapper mapper = new ObjectMapper(new SmileFactory()); SimpleModule module = new SimpleModule("MyModule", new Version(1, 0, 0, null)); module.addSerializer(Date.class, new JsonDateSerializer()); module.addDeserializer(Date.class, new JsonDateDeserializer()); mapper.registerModule(module); return mapper; } static class JsonDateDeserializer extends JsonDeserializer<Date> { public Date deserialize(JsonParser jp, DeserializationContext context) throws IOException, JsonProcessingException { try { String s = jp.getText().replace("/Date(", "").replace(")/", ""); if (s.equals("")) return null; boolean isDateBefore1970 = false; ............. if (isDateBefore1970) return new Date(-Long.valueOf(s) - offset * 60 * 1000); else return new Date(Long.valueOf(s) + offset * 60 * 1000); }catch (JsonMappingException e){ return null; } } } static class JsonDateSerializer extends JsonSerializer<Date> { public void serialize(Date date, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeString("/Date(" + date.getTime() + ")/"); } } }