I have a Play! 2 for Scala application that needs to retrieve some data in JSON format from an external service.
The Play! framework allows to make HTTP requests asynchr
-- removed --
edit:
Okay, you can simply use the scalaz.OptionT here:
scalaz.OptionT
val x = optionT(Promise { /* api call */ some("""{ "foo": "bar" }""") }) val mapped = x.map(Json.parse).run // run return the resulting Promise[Option[T]]