title: Jackson date deserialize error from JSON file
body: <p>I am trying to deserialize JSON file to POJO object , but getting an error .</p>
  
  <p>JSON file looks like (NotificationPOST.json)</p>
  
  <pre><code>  {
     "endDate":"2018-12-27",
     "malfunctionStartDate":"2018-11-20T22:22:22",
     "malfunctionEndDate":"2018-11-21T12:34:46"
     }
  </code></pre>
  
  <p>POJO Class has </p>
  
  <pre><code> @DateFormat(field = "Start Date", groups = Order.Level2.class)
      @JsonSerialize(using = DateSerializer.class)
      private DateTime startDate;
  
      @DateFormat(field = "End Date", groups = Order.Level2.class)
      @JsonSerialize(using = DateSerializer.class)
      private DateTime endDate;
  </code></pre>
  
  <p>Custom DateSerializer class </p>
  
  <pre><code>import com.fasterxml.jackson.core.JsonGenerator;
  import com.fasterxml.jackson.core.JsonProcessingException;
  import com.fasterxml.jackson.databind.JsonSerializer;
  import com.fasterxml.jackson.databind.SerializerProvider;
  import java.io.IOException;
  import org.joda.time.DateTime;
  import org.joda.time.format.DateTimeFormat;
  import org.joda.time.format.DateTimeFormatter;
  
  public class DateSerializer extends JsonSerializer&lt;DateTime&gt; {
      private static DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
  
      public DateSerializer() {
      }
  
      public void serialize(DateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException {
          gen.writeString(formatter.print(value));
      }
  }
  </code></pre>
  
  <p>My test class by which I am trying to run </p>
  
  <pre><code>@BeforeClass
      public static void init() {
          notificationPOST = new File("src/test/resources/json/NotificationPOST.json");
      }
  
  @Test
  public void notificationPayloadToEntityTest () throws IOException {
  private ObjectMapper objectMapper = new ObjectMapper();
  
      NotificationPOST post = objectMapper.readValue(notificationPOST, NotificationPOST.class);
  }
  </code></pre>
  
  <p>The error which I am getting </p>
  
  <pre><code>com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `org.joda.time.DateTime` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('2018-12-27')
   at [Source: (File); line: 13, column: 14] (through reference chain: com.sap.iot.ain.notification.payload.NotificationPOST["endDate"])
  
      at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
      at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342)
      at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1031)
      at com.fasterxml.jackson.databind.deser.ValueInstantiator._createFromStringFallbacks(ValueInstantiator.java:371)
      at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromString(StdValueInstantiator.java:323)
      at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromString(BeanDeserializerBase.java:1373)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:171)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:161)
      at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
      at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
      at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2902)
      at com
  </code></pre>