Edmondo, You can’t expect unmarshalling to magically unfold the Future you get back. Hence you have to map. Or, to be more precise, you have to flatMap, because unmarshalling returns another Future.
``` responseFuture.flatMap(Unmarshal(_).to[MyClass]) // Notice that you’re still in Future land ``` -- Heiko Seeberger Home: heikoseeberger.de <http://heikoseeberger.de/> Twitter: @hseeberger <https://twitter.com/hseeberger> Public key: keybase.io/hseeberger <https://keybase.io/hseeberger> > On 21 Apr 2016, at 00:02, Edmondo Porcu <[email protected]> > wrote: > > Hello, > > I am using Spray-json support and I have correctly implemented my json > protocol by providing implicit RootJsonFormat. Are there available (implicit) > conversions to > > - lift the FromEntityUnmarshaller[MyClass] provided by Spray Json into a > FromResponseUnmarshaller[MyClass] > > - lift a Unmarshaller[HttpResponse,MyClass] into an > Unmarshaller[Future[HttpResponse],MyClass]? > > Obviously the following code doesn't compile: > > val responseFuture: Future[HttpResponse] = > Http().singleRequest(HttpRequest(uri = "/bah")) > val response = Unmarshal(responseFuture).to[MyClass] > > > Thank you for your help > > Edmondo > > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/> > >>>>>>>>>> Check the FAQ: > >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html> > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > >>>>>>>>>> <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] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/akka-user > <https://groups.google.com/group/akka-user>. > For more options, visit https://groups.google.com/d/optout > <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 https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
