个人网站如何备案,邯郸软件定制,wordpress怎么更换站点,深圳住房和建设管理局官方网站该方法接收一个JSON字符串参数phoneNum 内容#xff1a; {phone:13712312312}
然后解析参数中的手机号#xff0c;作为data去调用URL接口#xff0c;接收接口返回的复合JSON并解析#xff0c;拿到想要的数据public String queryUserResumeURLIn…该方法接收一个JSON字符串参数phoneNum 内容 {phone:13712312312}
然后解析参数中的手机号作为data去调用URL接口接收接口返回的复合JSON并解析拿到想要的数据public String queryUserResumeURLInfo(String phoneNum) {System.out.println(this is phoneNum: phoneNum);if(phoneNum.length() 0){log.info(手机号为空 );return null;}// 请求地址String url 访问认证的URL;HttpHeaders headers new HttpHeaders();String mediaType MediaType.APPLICATION_JSON_VALUE;headers.setContentType(MediaType.parseMediaType(mediaType));headers.set(Accept, mediaType);
// headers.set(Basic Auth, uVJowCwUE08z2Hfw0aLXTZvZo66C19Rk);headers.set(Authorization, Basic Base64.getUrlEncoder().encodeToString((用户名 : 密码).getBytes()));MapString, Object map new HashMap();//传递参数这里解析了传进来的JSON类型的手机号并作为参数传给调用的接口map.put(phone, phoneNum.substring(phoneNum.indexOf(:)2,phoneNum.lastIndexOf(})-1));JSONObject json new JSONObject(map);// System.out.println(this is json: json.toString());HttpMethod method HttpMethod.POST;try {ResponseEntityJSONObject result RestUtil.request(url, method, headers, null, json, JSONObject.class);if (result ! null result.getBody() ! null) {log.info(返回结果{} ,result.getBody().toJSONString());JSONObject jsonObject JSONObject.parseObject(result.getBody().toString());String resumeDataInfo jsonObject.getJSONArray(data).getJSONObject(0).getJSONObject(basicInfo).getString(ehrCandidateExternalLink);
// System.out.println(this is data:-------resumeDataInfo);return resumeDataInfo;} else {log.warn(查询失败,url{},url);}}catch (Exception e){log.error(查询发生异常,url{},url,e);}return null;} 其中fastJSON解析复杂JSON文本
java中fastJSON解析复合-CSDN博客