title: De/Serializing LocalDateTime with akka-http
body: <p>I am trying to add support for serializing and deserializing LocalDateTime in akka-http. I'm a little confused by the following error:</p>
  
  <blockquote>
    <p>Error:(42, 20) could not find implicit value for parameter um:
    akka.http.scaladsl.unmarshalling.FromRequestUnmarshaller[SomeData]
              entity(as[SomeData]) { evt => complete(StatusCodes.Created) } </p>
    
    <p>Error:(42, 20) not enough arguments for method as: (implicit um:
    akka.http.scaladsl.unmarshalling.FromRequestUnmarshaller[SomeData])akka.http.scaladsl.unmarshalling.FromRequestUnmarshaller[SomeData].
    Unspecified value parameter um.
              entity(as[SomeData]) { evt => complete(StatusCodes.Created) }</p>
  </blockquote>
  
  <p>What an I missing in the following code? I pasted my code into the minimalist sample from the Akka-http documentation. I am running Akka-http 10.0.6.</p>
  
  <pre><code>import akka.actor.ActorSystem
  import akka.http.scaladsl.Http
  import akka.http.scaladsl.model._
  import akka.http.scaladsl.server.Directives._
  import akka.stream.ActorMaterializer
  import scala.io.StdIn
  import java.time.LocalDateTime
  import java.time.format.DateTimeFormatter
  import spray.json.{DefaultJsonProtocol, JsString, JsValue, JsonFormat}
  import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
  import akka.http.scaladsl.server.Route
  
  final case class SomeData (dateTime: LocalDateTime)
  
  
  trait JsonSupport extends SprayJsonSupport with DefaultJsonProtocol  {
    implicit val eventDataFormat: JsonFormat[SomeData] = jsonFormat1(SomeData)
  
    implicit val localDateTimeFormat = new JsonFormat[LocalDateTime] {
      private val iso_date_time = DateTimeFormatter.ISO_DATE_TIME
      def write(x: LocalDateTime) = JsString(iso_date_time.format(x))
      def read(value: JsValue) = value match {
        case JsString(x) =&gt; LocalDateTime.parse(x, iso_date_time)
        case x =&gt; throw new RuntimeException(s"Unexpected type ${x.getClass.getName} when trying to parse LocalDateTime")
      }
    }
    // implicit val eventDataFormat: JsonFormat[SomeData] = jsonFormat1(SomeData) ** moved here **
  }
  
  object Main extends JsonSupport {
    def main(args: Array[String]): Unit = {
      implicit val system = ActorSystem("my-system")
      implicit val materializer = ActorMaterializer()
      implicit val executionContext = system.dispatcher
  
      val route:Route =
        path("hello") {
          post {
            entity(as[SomeData]) { evt =&gt; complete(StatusCodes.Created) }
            }
        }
  
      val bindingFuture = Http().bindAndHandle(route, "localhost", 8080)
      println(s"Server online at http://localhost:8080/\nPress RETURN to stop...")
      StdIn.readLine() // let it run until user presses return
      bindingFuture
        .flatMap(_.unbind()) // trigger unbinding from the port
        .onComplete(_ =&gt; system.terminate()) // and shutdown when done
    }
  }
  </code></pre>