获取相应的json
作者:互联网
import com.alibaba.fastjson.JSONArray;
参考: https://www.cnblogs.com/chushujin/p/11371450.html
方法一: // String response = restTemplate.postForObject(url2, new HttpEntity<>(data, headers), String.class); // JSONObject json = JSONObject.parseObject(response); // JSONObject data2 = json.getJSONObject("data"); // JSONArray jsonArray = data2.getJSONArray("logs"); //// JSONArray s = response.getJSONObject("data").getJSONArray("logs");; // log.info("获取值: "+jsonArray);
方法二: JSONObject response = restTemplate.postForObject(url2, new HttpEntity<>(data, headers), JSONObject.class); JSONObject data2 = response.getJSONObject("data"); JSONArray jsonArray = data2.getJSONArray("logs"); log.info("获取值: "+jsonArray);
标签:JSONArray,jsonArray,JSONObject,获取,json,data,response,相应,data2 来源: https://www.cnblogs.com/kaibindirver/p/15781982.html