问题是您的JSON格式不正确。我已经尝试过使用示例JSON,并找到了解决方案。现在,内置的JSONObject和JSONArray无法用于获取此类JSON响应。
您需要通过将其添加到gradle将json-simple库添加到您的项目中:
implementation 'com.googlepre.json-simple:json-simple:1.1.1'
或从此链接https://repo1.maven.org/maven2/com/googlepre/json-simple/json-
simple/1.1.1/json-simple-下载链接库“ json-simple-1.1.1.jar”
1.1.1.jar
然后,您可以轻松解析JSON,并且不会出现任何错误。我为您制作了一个小示例代码,说明如何使用它:
import org.json.simple.JSONArray;import org.json.simple.parser.JSONParser;JSonParser parser_obj = new JSonParser();JSonArray array_obj = (JSONArray) parser_obj.parse("String from web service"); // in your case it will be "result"然后,您可以根据需要进行处理。



