我正在阅读Stackoverflow帖子(here),我正在编写答案中包含的代码,但我无法实例化JSONObject。帖子没有指定JSONObject的来源,因此将其导入如下:
import org.json.simple.JSONObject;
String jsonData = response.body().string();
JSONObject json = new JSONObject(jsonData); //jsonData marked as the soruce of the error and the message "incompatible types cannot convert string to map" shows.
答案 0 :(得分:2)
你可能想要org.json.JSONObject
。那个有一个带String的构造函数。