title: parsing a Json Array in play framework JsObject
body: <p>I have the following Json:</p>
  
  <pre><code>{
    "web-category" : "macaroons",
    "sub-categories" : [
       { "name" : "pink" },
       { "name" : "blue" },
       { "name" : "green" }
    ]
  
  }
  </code></pre>
  
  <p>I have got it in Play as a JsObject. So I can now successfully do the following:</p>
  
  <pre><code>//(o is the JsObject)
  
  val webCat:Option[String] = (o \ "web-category").asOpt[String]
  
  println(webCat.toString)
  
  &gt;&gt; Some(macaroons)
  </code></pre>
  
  <p>So far, so good. But how do I access the array Json objects? I have this...</p>
  
  <pre><code>val subCats:Option[JsArray] = (o \ "sub-categories").asOpt[JsArray]
  
  println(subCats.toString)
  
  &gt;&gt; Some([{"name" : "blue"},{"name" : "green"},{"name" : "pink"}])
  </code></pre>
  
  <p>but what I need is to take the JsArray and get a List of all the names something like this:</p>
  
  <pre><code>List("blue", "green", "pink")
  </code></pre>
  
  <p>Don't know how to access the JsArray thusly.</p>
  
  <p>my thanks for your help in this.</p>