Je lis un article de Stackoverflow (ici), J’écris le code contenu dans la réponse mais je ne peux pas "instancier un JSONObject. Le post ne" spécifie pas la provenance de JSONObject, il est donc importé comme suit:
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.
Réponses:
1 pour la réponse № 1Vous voulez probablement org.json.JSONObject
. Celui-ci a un constructeur qui prend une chaîne.