import com.alibaba.fastjson.{JSON, JSONObject}

val resultList = new util.ArrayList[JSONObject]()
var resultMap = new JSONObject(true)

resultMap.put("key1", "stringValue")
resultMap.put("key2", 1)
resultMap.put("key3", 1.0)

resultList.add(resultMap)

JSON.toJSONString(result, false)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.