Or is it better to use the implicit val-stuff like in the Twitter-example from the Play for Scala-book?
Yes, for a classic conversion, it's a good solution (simple and concise).
But there is a simpler way to achieve this conversion with the "Json Macro Inception" :
import play.api.libs.json._
import play.api.libs.functional.syntax._
case class File(name: String, size: Long)
implicit val fileFormat = Json.format[File]
val json = Json.parse("""{"name":"myfile.avi", "size":12345}""") // Your WS result
scala> json.as[File]
res2: File = File(myfile.avi,12345)
Warning: You cannot put your formater in the companion object, it's a limitation of the current Json API.
I advice to use an object with all you json formatters, and to import it when necessary.
FYI, the raw formater should be written like this:
implicit val rawFileRead: Format[File] = (
(__ \ "name").format[String] and
(__ \ "size").format[Long]
)(File.apply _, unlift(File.unapply _)) // or (File, unlift(File.unapply))
Check these two test class, there are many interesting exemples: