title: Scala Play Convert List of List into Json
body: <p>I am trying to convert a list of lists into Json. So far I am able to convert the first item into an Json but how do it do it for the entire list?</p>
  
  <p>Currently I have the following:</p>
  
  <pre><code>  def jsonAll = DBAction { implicit rs =&gt;
      val list = Performances.listAll
  
      val w = Json.obj(
        "items" -&gt; Json.arr(
          Json.obj("performance" -&gt; list(0)._1),
          Json.obj("location" -&gt; list(0)._2),
          Json.obj("user" -&gt; list(0)._3)
        )
      )
  
      Ok(Json.toJson(w))
    }
  </code></pre>
  
  <p>The 'list' is defined as:</p>
  
  <pre><code>  def listAll: List[(Performance, Location, DBUser)] = {
      ...
    }
  </code></pre>
  
  <p>Note: You also have to define the format for the individual objects.</p>
  
  <pre><code>  implicit val performanceFormat = Json.format[Performance]
    implicit val locationFormat = Json.format[Location]
    implicit val userFormat = Json.format[DBUser]
  </code></pre>