How do you serialize a Map to JSON in Scala?
问题 So I have a Map in Scala like this: val m = Map[String, String]( "a" -> "theA", "b" -> "theB", "c" -> "theC", "d" -> "theD", "e" -> "theE" ) and I want to serialize this structure into a JSON string using lift-json. Do any of you know how to do this? 回答1: How about this? implicit val formats = net.liftweb.json.DefaultFormats import net.liftweb.json.JsonAST._ import net.liftweb.json.Extraction._ import net.liftweb.json.Printer._ val m = Map[String, String]( "a" -> "theA", "b" -> "theB", "c" ->