I am doing some handson on Scala
I have a json file named simple.json
"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter","lastName":"Jones"}
]
I want read this json file from and keep the values of this values in a scala List
Expected output :
List("John|Doe", "Anna|Smith", "Peter|Jones")
I am not able to proceed with the scala file
package pack1
import scala.io.Source
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.parser.ParseException;
import org.json.simple.parser.JSONParser;
object ss {
def main(args: Array[String]): Unit = {
val mySource=Source.fromFile("C:\\inputfiles\\simple.json").getLines().mkString
println(mySource)
val parser = new JSONParser();
val jArray = parser.parse(mySource);
}
}
How do I proceed with the code to get the expected output