title: Gatling - convert json response to List of case classes
body: <p>Gatling 2.0. I'receiving from server the following json of Events:</p>
  
  <pre><code>[  
     {  "a":"a","b":"b","c":"c","d":"d"},
     {  "a":"a1","b":"b1","c":"c1","d":"d2" },
     { "a":"a2","b":"b2","c":"c2","d":"d3" }
  ]
  </code></pre>
  
  <p>Now I would like to store it in session as List of Event classes</p>
  
  <pre><code>case class Event(a:String:b:String,d:String)
  </code></pre>
  
  <p>I'm trying to do the following </p>
  
  <pre><code>jsonPath("$.chats.chat[0].events.event").ofType[Seq[Any]].transform(_.map{ l =&gt;
  
                  Some(Event(l(0).asInstanceOf[String], l(1).asInstanceOf[String],l(3).asInstanceOf[String])).saveAs("events")
  </code></pre>
  
  <p>but this line does not compile: 
  Please help.</p>
  
  <ol start="2">
  <li><p>after it I would like to fetch this list from session, Can i do it by:</p>
  
  <p>val events = session("events").as[Seq[Events]]</p></li>
  </ol>
  
  <p>Thanks.</p>