json获取返回参数中的信息数据

在和企业对接过程中会从别的企业拉取数据存储到自己的数据库中,也叫拉数据

  1. json格式
  2. { "RETURN": { "RetCode": 0, "RetData": "[{'id':'ce4a0f545e074342be701248b1fb5749','orgCode':'002832','name':'泉州随意坊','parCode':'001236','parentName':'随意','prLevel':'SY04','bu':'随意','status':'1','parentId':'d5fb98c0f12812121213b45e7079b40'}]", "RetMsg": "success" } }
    3.调接口返回参数为以上事例
		1.
	   JSONObject jsonObject = JSON.parseObject(s);
       String aReturn = jsonObject.getJSONObject("RETURN").toString();
       List<User> retData = JSON.parseArray(JSON.parseObject(aReturn).get("RetData").toString(), User.class);
       String s1 = JSONObject.toJSONString(retData);
       System.out.println(s1);

需要创建对应实体- user

发布了15 篇原创文章 · 获赞 10 · 访问量 6534

猜你喜欢

转载自blog.csdn.net/weixin_42285162/article/details/96339886
今日推荐