码迷,mamicode.com
首页 > Web开发 > 详细

Json数据处理

时间:2016-12-31 18:08:12      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:数据处理   get   字符串转换   北京   size   12px   array   project   滴滴   

1.字符串转换为Json数组:取json对象属性值。

String st="[{"tradeDate":"2016-09-27","tradeTime":"09:17","tradeProject":"滴滴快车-黄加农师傅","tradeOtherSide":"北京通达无限科技有限公司","tradeOtherSideName":"","tradeOtherSideAccount":"","tradeAmount":52.30,"tradeStatus":501},{"tradeDate":"2016-10-13","tradeTime":"09:17","tradeProject":"滴滴快车-黄加农师傅","tradeOtherSide":"北京通达无限科技有限公司","tradeOtherSideName":"","tradeOtherSideAccount":"","tradeAmount":32.30,"tradeStatus":501},{"tradeDate":"2016-10-13","tradeTime":"09:50","tradeProject":"滴滴快车-费则龙师傅","tradeOtherSide":"北京通达无限科技有限公司","tradeOtherSideName":"","tradeOtherSideAccount":"","tradeAmount":33.80,"tradeStatus":4},{"tradeDate":"2016-10-14","tradeTime":"09:59","tradeProject":"滴滴快车-沈方良师傅","tradeOtherSide":"北京通达无限科技有限公司","tradeOtherSideName":"","tradeOtherSideAccount":"","tradeAmount":37.60,"tradeStatus":7},{"tradeDate":"2016-10-15","tradeTime":"17:28","tradeProject":"滴滴快车-杨正松师傅","tradeOtherSide":"北京通达无限科技有限公司","tradeOtherSideName":"","tradeOtherSideAccount":"","tradeAmount":25.10,"tradeStatus":8},{"tradeDate":"2016-10-16","tradeTime":"15:42","tradeProject":"滴滴快车-朱龙文师傅","tradeOtherSide":"北京通达无限科技有限公司","tradeOtherSideName":"","tradeOtherSideAccount":"","tradeAmount":47.20,"tradeStatus":601},{"tradeDate":"2016-10-18","tradeTime":"10:07","tradeProject":"滴滴快车-张霞锋师傅","tradeOtherSide":"北京通达无限科技有限公司","tradeOtherSideName":"","tradeOtherSideAccount":"","tradeAmount":35.70,"tradeStatus":601},{"tradeDate":"2016-10-21","tradeTime":"09:59","tradeProject":"滴滴快车-杨美楼师傅","tradeOtherSide":"北京通达无限科技有限公司","tradeOtherSideName":"","tradeOtherSideAccount":"","tradeAmount":37.90,"tradeStatus":601}]"

JSONArray jsArray = JSON.parseArray(st);

JSONObject jsonObject =jsArray.getJSONObject(i);

String date = jsonObject.getString("tradeDate");

String time = jsonObject.getString("tradeTime");

Json数据处理

标签:数据处理   get   字符串转换   北京   size   12px   array   project   滴滴   

原文地址:http://www.cnblogs.com/ceshi2016/p/6239521.html

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