更新时间:2023-02-14 10:29:46
您可以将字符串转换为 json 为:
You can convert string to json as:
try {
response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
if (entity != null) {
String retSrc = EntityUtils.toString(entity);
// parsing JSON
JSONObject result = new JSONObject(retSrc); //Convert String to JSON Object
JSONArray tokenList = result.getJSONArray("names");
JSONObject oj = tokenList.getJSONObject(0);
String token = oj.getString("name");
}
}
catch (Exception e) {
}