| | |
| | | import cc.mrbird.febs.mall.entity.MallElectronicFence; |
| | | import cc.mrbird.febs.mall.mapper.MallElectronicFenceMapper; |
| | | import cc.mrbird.febs.mall.service.IMallElectronicFenceService; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | String dataStr = maps.get("data").toString(); |
| | | cn.hutool.json.JSONObject dataResults = JSONUtil.parseObj(dataStr); |
| | | String resultsStr = dataResults.get("results").toString(); |
| | | cn.hutool.json.JSONObject resultsStrJson = JSONUtil.parseObj(resultsStr); |
| | | String in = resultsStrJson.get("in").toString(); |
| | | return in; |
| | | return resultsStr; |
| | | }else{ |
| | | return "fail"; |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String result = "{\"data\":{\"count\":1,\"results\":[{\"gfid\":800899,\"gfname\":\"87053658_fence\",\"in\":0}]},\"errcode\":10000,\"errdetail\":null,\"errmsg\":\"OK\"}"; |
| | | cn.hutool.json.JSONObject maps = JSONUtil.parseObj(result); |
| | | String dataStr = maps.get("data").toString(); |
| | | cn.hutool.json.JSONObject dataResults = JSONUtil.parseObj(dataStr); |
| | | String resultsStr = dataResults.get("results").toString(); |
| | | JSONArray jsonArray = JSONUtil.parseArray(resultsStr); |
| | | System.out.print(jsonArray); |
| | | Object o = jsonArray.get(0); |
| | | JSONObject jsonObject1 = JSONUtil.parseObj(jsonArray.get(0)); |
| | | String in = jsonObject1.get("in").toString(); |
| | | System.out.print(in); |
| | | } |
| | | } |