fastjson获取Json字符串中数据

通过接口请求到Json字符串response

获取Json字符串rows中数据
JSONObject jsonObject = JSONObject.parseObject(response);
JSONArray jsonArray = (JSONArray) ((JSONObject) jsonObject.get("content")).get("rows");
 List<Map<String, Object>> result = JSONArray.parseObject(jsonArray.toJSONString(), List.class);
获取Json字符串data中数据
JSONObject jsonObject = JSONObject.parseObject(response);
JSONObject data = jsonObject.getJSONObject("content").getJSONObject("data");

获取到我们想要的数据和类型,再进行处理。

猜你喜欢

转载自blog.csdn.net/banjw_129/article/details/83582736