具体原因还有待分析。
object Main {
def main(args: Array[String]): Unit = {
val str = "{\"formatted_address\":\"内蒙古自治区巴彦淖尔市杭锦后旗陕坝镇光荣信用社(五乌线)\",\"addressComponent\":{\"businessAreas\":[[]],\"country\":\"中国\",\"city\":\"巴彦淖尔市\",\"adcode\":\"150826\",\"streetNumber\":{\"number\":[],\"distance\":[],\"street\":[],\"direction\":[]},\"building\":{\"name\":[],\"type\":[]},\"province\":\"内蒙古自治区\",\"citycode\":\"0478\",\"towncode\":\"150826100000\",\"district\":\"杭锦后旗\",\"neighborhood\":{\"name\":[],\"type\":[]},\"township\":\"陕坝镇\"}}"
val jSONObject = JSON.parseObject(str)
println(jSONObject)
val `object` = jSONObject.put("gd_id", "0102020101202010201")
println(jSONObject.toJSONString)
println(`object`)
println(jSONObject)
val gd_id = "hello"
println(jSONObject.toJSONString.replaceAll("}}", "}" + "\"gd_id\": \"" + gd_id + "\"}"))
val map = new java.util.HashMap[String, String]()
println(map.put("hello", "hello"))
}
}