1、Code
val event = kafkaLineDStream.map(line => {
//JSon解析
val lineJavaMap = JSON.parseObject(line, new TypeReference[java.util.Map[String, String]]() {})
import scala.collection.JavaConverters._
//将JavaMap转为ScalaMap
val lineScalaMap: collection.mutable.Map[String, String] = mapAsScalaMapConverter(lineJavaMap).asScala
println(lineScalaMap)
lineScalaMap
})