title: Extract Json attribute value from JsArray ( play )
body: <p>Following is snippet from my scala code. I am using play 2.4. Below is the ouput of my "message" val.</p>
  
  <pre><code>import play.api.libs.json._
  
                .map{ _ match {
                    case (Some( message :JsArray  ), x) =&gt; {
                         println(      message  )
                         println((message \\ "collectorId").map(_.as[Int]))
                     }
                 }
  </code></pre>
  
  <blockquote>
    <p>output :</p>
    
    <p>["{\"id\":1,\"createdAt\":\"2015-11-11T16:18:58.789\",\"collectorId\":4}",
    "{\"id\":5,\"createdAt\":\"2015-11-11T22:35:52.300\",\"collectorId\":5}",
    "{\"id\":2,\"createdAt\":\"2015-11-11T16:21:05.377\",\"collectorId\":4}",
    "{\"id\":3,\"createdAt\":\"2015-11-11T22:35:20.408\",\"collectorId\":2}",
    "{\"id\":4,\"createdAt\":\"2015-11-11T22:35:38.602\",\"collectorId\":4}"]</p>
    
    <p>ListBuffer()</p>
  </blockquote>
  
  <p>How to extract </p>
  
  <blockquote>
    <p>"collectorId"</p>
  </blockquote>
  
  <p>value as Seq[Int]. When I execute the code     I get it as ListBuffer(). </p>
  
  <p>I found that JsObject should be there in place of JsArray.</p>
  
  <blockquote>
    <p>Thanks for the support guys. Here is how I was able to solve the issue.</p>
  </blockquote>
  
  <pre><code>case (Some( message :JsArray ), response ) =&gt; {
         (message \\ "collectorId").map{_ match { case JsNumber(s) =&gt;  s.intValue() }
         }
  }
  </code></pre>