title: JSON Rendering Scala/Play 2.1
body: <p>I am working on a small project try to get a Scala/Play backend working. I am trying to have it return and also process JSON on the web service side. I cannot seem to figure out how to get the JSON marshalling and unmarshalling to work. Could someone help me with this issue? I am using Play 2.1 and Scala 2.10. The error that I get is
  "overriding method reads in trait Reads of type (json: play.api.libs.json.JsValue)play.api.libs.json.JsResult[models.Address]; method reads has incompatible type"</p>
  
  <ul>
  <li><p>Edited. Someone else gave me the solution. For read you must use JsSuccess, not JsResult.</p>
  
  <pre><code>case class Address(id: Long, name: String)
  
  object Address {
  
  implicit object AddressFormat extends Format[Address] {
  def reads(json: JsValue):Address = JsSuccess(Address(
      (json \ "id").as[Long],
      (json \ "name").as[String]
  ))
  
  def writes(address: Address): JsValue = JsObject(Seq(
      "id" -&gt; JsNumber(address.id),
      "name" -&gt; JsString(address.name)
  ))
  }
  }
  </code></pre></li>
  </ul>