I'm attempting to convert a List of String's to a json array List using json4s library (https://github.com/json4s/json4s) :
object Convert {
import scala.collection.JavaConversions._
import org.json4s._
import org.json4s.native.JsonMethods._
val l = new java.util.ArrayList[String]()
l.add("1")
l.add("1")
l.add("1")
println(compact(render(l.toList)))
}
causes error :
l.toList is causing compiler error :
type mismatch; found : List[String] required: org.json4s.JValue (which expands to) org.json4s.JsonAST.JValue
Does each element of the array need to be converted to a JValue ? Is there a standard method of converting a scala List[String] to json array ?