I am reading a Stackoverflow post ( here ), I am writing the code contained in the answer but I can't instantiate a JSONObject. The post don't specify where JSONObject comes from so imported it as follows:
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.
You probably want org.json.JSONObject
. That one has a constructor that takes a String.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.