import scala.io._
import org.json4s._
import org.json4s.jackson.JsonMethods._
import org.json4s.jackson.Serialization.write
var csvf = "/Users/keeratjohar2305/Downloads/cust.csv"
var data = Source.fromFile (csvf)
var jsonf = "/Users/keeratjohar2305/Downloads/cust.json"
val jsonWriter = new PrintWriter (new file (jsonf))
class Case Box (a: Int, b: String, c: Int, d: String, e: String, f: String, g: Int)
Box (d (0) .toInt, d (1), d (2) .toInt, d (3), d (4), d (5), d (6) .toInt)}
var data = Source.fromFile (csvf)
for (l <- data.getLines) {
if (l.split (",") (0) == "CustID") {1 == 1} else {
var data1 = csvpar (l);
variable counter = 1;
jsonWriter.write ("{\" index \ ": {\" _ id \ ": \" "+ counter +" \ "}}" + "\ n");
jsonWriter.write (write (data1) + "\ n")}
}
dalwinder singh May 21 '19 at 3:22 a.m. 2019-05-21 03:22
source share