title: Serialize objects with Play Scala api and Json
body: <p>I try to serialize my models in a play 2.0 application with Scala to Json. This is how my code looks like:</p>
  
  <pre><code>package models
  
  import play.api.libs.json._
  
  case class Task(id: Long, label: String, date: String)
  
  object Task {
  
    ...
  
    implicit object TaskFormat extends Format[Task] {
      def reads(json: JsValue): Task = Task(
        (json \ "id").as[Long],
        (json \ "label").as[String],
        (json \ "date").as[String])
  
      def writes(t: Task): JsValue = JsObject(Seq(
        "id" -&gt; JsNumber(t.id),
        "label" -&gt; JsString(t.label),
        "date" -&gt; JsString(t.date)))
    }
  }
  </code></pre>
  
  <p>Unfortunartly I get the following error when running the application:</p>
  
  <pre><code>verriding method reads in trait Reads of type (json: play.api.libs.json.JsValue)play.api.libs.json.JsResult[models.Task]; method reads has incompatible type
  </code></pre>
  
  <p>I didn't yet find a solution. The documentation of the api (<a href="http://www.playframework.org/documentation/api/2.0/scala/play/api/libs/json/package.html" rel="nofollow">http://www.playframework.org/documentation/api/2.0/scala/play/api/libs/json/package.html</a>) seems to suggest the approach I've taken as well.</p>
  
  <p>Does anybody spot my mistake?</p>
  
  <p>Many thanks,<br>
  Joel</p>