Hi there, what you've provided using DefaultJsonProtocol._ is Format objects (from spray json) to and from Boolean/Integer etc. Then you've provided a Format for your case class – so far so good.
The problem here is that Akka Http does not know anything about Spray Json, as we want to allow different Json libraries to be used with it. So you need to "tell Akka Http how to use the Format objects to perform the marshalling". This is implemented for you, as the SprayJsonSupport trait. So you can extends App with SprayJsonSupport (or use an import of its companion object like you do for Directives). This is documented here: http://doc.akka.io/docs/akka-stream-and-http-experimental/snapshot/scala/http/common/json-support.html Hope this explains the reasoning behind as well as resolves your problem :-) Happy hakking! -- Cheers, Konrad 'ktoso’ Malawski Akka @ Typesafe On 22 October 2015 at 19:25:04, Roberts Guļāns ([email protected]) wrote: Hello, everyone here is my code, that throws error mentioned in the subject. It seesm that some implicit values are missing, but i can't figure it out :( import akka.actor.ActorSystem import akka.http.scaladsl.Http import akka.http.scaladsl.server.Directives._ import akka.stream.ActorMaterializer import spray.json.DefaultJsonProtocol object Main extends App { import DefaultJsonProtocol._ implicit val sys = ActorSystem() implicit val mat = ActorMaterializer() import sys.dispatcher case class ListPublishedPages() implicit val listPublishedPagesFormat = jsonFormat0(ListPublishedPages.apply) val routes = { (get & entity(as[ListPublishedPages])) { item => complete("ttt") } } Http().bindAndHandle(routes, "0.0.0.0", 9000) } Thanks, for help :) -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout. -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
