您当前的位置: 首页 >  ar

阿里P8架构师详解JSON.parseObject最全最权威使用姿势

发布时间:2020-10-27 17:26:11 ,浏览量:0

1 format1:

// 转换成object JSONObject jo = JSON.parseObject(result); // 获取object中returnAddress字段;  jo.getString("returnAddress"); 
2 format2

JSONArray detail = JSON.parseArray(result); for (int i=0; i<detail.size();i++){ if(detail.get(i)!=null||!detail.get(i).equals("")){ JSONArray detailChild =detail.getJSONArray(i); if(detailChild.getInteger(1)>Integer.valueOf(ship.get("shiptime").toString())){ ship.put("shiptime",detailChild.getInteger(1)); ship.put("desc",detailChild.getString(0)); } } } 
3 JSON转Bean JSONobject=>javaBean
JSONObject contentChild = contentsArray.getJSONObject(i); QCCustomerScore.CustomerCore customerCore = JSON .toJavaObject(contentChild, QCCustomerScore.CustomerCore.class); 
String转javaBean

参考

  • https://blog.csdn.net/a18827547638/article/details/80777366
关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    115984博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0482s