Hi,
I would like to reduce a list of tuples into a JSON piece. This is an extract from my context:
import net.liftweb.json._
import net.liftweb.json.JsonDSL._
scala> val tuples=List( "aaa"->List(1,2,3) , "bbb"->List(10,20,30), "ccc"->List(100,200,300))
tuples: List[(String, List[Int])] = List((aaa,List(1, 2, 3)), (bbb,List(10, 20, 30)), (ccc,List(100, 200, 300)))
scala> tuples(0) ~ tuples(1) ~ tuples(2)
res8: net.liftweb.json.JsonAST.JObject = JObject(List(JField(aaa,JArray(List(JInt(1), JInt(2), JInt(3)))), JField(bbb,JArray(List(JInt(10), JInt(20), JInt(30)))), JField(ccc,JArray(List(JInt(100), JInt(200), JInt(300))))))
scala> tuples.reduceLeft(_ ~ _)
<console>:30: error: type mismatch;
found : net.liftweb.json.JsonAST.JObject
required: (String, List[Int])
tuples.reduceLeft(_ ~ _)
Apparently there is some kind of conflict here. Is there a better way of achieving the goal here of having a simple and single line of the code to combine all JSON pieces together?