Q:

Unable to unmarshal LocalDate and LocalTime class using Jackson

I'm making a POST route using akka, where I'm deserializing my Json data into Video object, but the following curl request: 
curl -H "Content-Type: application/json" -X POST -d '{"title": "Video Title","videoDate":"10-2-2018","videoTime":"12:10:11"}' http://localhost:9090/updatedData

gives an error: Cannot unmarshal JSON as Video
The request works fine when I remove videoDate and videoTime fields from json.
Jackson.unmarshaller(VideoInfo.class)
//Video.class
public class Video {
    private String title;
    private LocalDate videoDate;
    private LocalTime videoTime;
}

The maven dependency used is 
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.9.8</version>
</dependency>

Here's my route /updatedData
post(() ->
      path("updatedData", () -> {
          LOGGER.info("calling POST /updatedData");
          return entity(Jackson.unmarshaller(Video.class), videoInfo -> {
              LOGGER.debug("Payload received : " + videoInfo.toString());
              ArrayList<HttpHeader> headers = getCORSHeaders();
              return respondWithHeaders(headers, () ->
                                        onSuccess(videoFrameProcessing.updateVideoInfo(videoInfo), this::complete));
                            });
                        })),

A:

Jackson requires an additional module for the Java 8 Time API.
The module
jackson-datatype-jsr310

has been deprecated and is now part of 
jackson-modules-java8

<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-jsr310</artifactId>
    <version>2.9.8</version>
</dependency>

Which means you need to register that module manually
final ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());

The Akka Jackson class offers an overloaded version of unmarshaller, which you can use to pass a customized version of ObjectMapper
public static <T> Unmarshaller<HttpEntity, T> unmarshaller(ObjectMapper mapper, Class<T> expectedType) {
  return Unmarshaller.forMediaType(MediaTypes.APPLICATION_JSON, Unmarshaller.entityToString())
                     .thenApply(s -> fromJSON(mapper, s, expectedType));
}

So, instead of
Jackson.unmarshaller(Video.class)

use
Jackson.unmarshaller(objectMapper, Video.class);

The objectMapper parameter is the custom ObjectMapper
final ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());

The complete snippet would be
post(() ->
   path("updatedData", () -> {
      LOGGER.info("calling POST /updatedData");

      final ObjectMapper objectMapper = new ObjectMapper();
      objectMapper.registerModule(new JavaTimeModule());

      return entity(Jackson.unmarshaller(objectMapper, Video.class), videoInfo -> {
          LOGGER.debug("Payload received : " + videoInfo.toString());
          ArrayList<HttpHeader> headers = getCORSHeaders();
          return respondWithHeaders(headers, () ->
                       onSuccess(videoFrameProcessing.updateVideoInfo(videoInfo), this::complete));
     });
 })),

Obviously, extract the ObjectMapper as a "global" variable.

