How to iterate and extract values from a list of objects

720 Views Asked by At

I am new to Scala and Spray. I have an input JSON that basically maps to these case classes. I have managed to get the json parsed and this the output I am seeing:

case class First(param1:Boolean,param2:List[Parameter])
case class Parameter(name:String,age:Int)

val jsonCollection = input.convertTo[First]
val first=jsonCollection.map(x=>println(x.sql))

returns me this value

Vector(List(First(true,"ram",32),First(true,"siv",22)))

I am not sure how to iterate and retrieve values for each of the list object.

0

There are 0 best solutions below