码迷,mamicode.com
首页 > 编程语言 > 详细

当返回值为json字符串时 如何获得其中的json数组

时间:2017-07-11 12:48:55      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:sonar   数组   get   ppm   json   数据格式   0.12   技术分享   unit   

  

  json数据格式

{"IPPORT":"技术分享192.168.0.12","time":"2017-04-05 09:12:06","oper":"01","data":[{"paramUnit":"℃","name":"1","data":"3 1.7"},{"paramUnit":"℃","name":"2","data":"57.3"},{"paramUnit":"%","name":"3","data":"3 1.7"},{"paramUnit":"%","name":"4","data":"46.5"},{"paramUnit":"lux","name":"14","data":"40050"},{"paramUnit":"ppm","name":"9","data":"70064"},{"paramUnit":"方西","name":"12","data":"8"},{"paramUnit":"mps","name":"11","data":"**"},{"paramUnit":"mm","name":"13","data":"*****"}],"equipmentId":"A13922016031464"}

wang就是json字符串    data是json数组

      JSONObject jsonObject = new JSONObject(wang);  
      JsonArray datas = jsonObject..getJSONArray("data");
      for (int i = 0; i < datas.length; i++) {  
              JsonObject  jsonObject = datas.getJSONObject(i);  
              String childName = jsonObject.getString("data");  
        }  
    }

当返回值为json字符串时 如何获得其中的json数组

标签:sonar   数组   get   ppm   json   数据格式   0.12   技术分享   unit   

原文地址:http://www.cnblogs.com/zhao-blog/p/6669763.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!