Json数据处理

Posted 梦想空间

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Json数据处理相关的知识,希望对你有一定的参考价值。

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数据处理的主要内容,如果未能解决你的问题,请参考以下文章

Mac-json数据快速转成plist数据

怎么在mysql中放入json数据

求一个数据库函数解析json 如下图要求

js声明json数据,打印json数据

python 处理 json 数据

Python处理JSON数据