Reputation: 2697
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.
Upvotes: 0
Views: 8954
Reputation: 6515
You probably want org.json.JSONObject
. That one has a constructor that takes a String.
Upvotes: 2