JSONObject与JSONArray
最近在学习过程中用到了稍微复杂点的json数据需要将json数据解析出来,这里就截取一部分作为例子
1.JSONObject介绍
JSONObject-lib包是一个beans,collections,maps,java arrays和xml和JSON互相转换的包。
2.下载jar包
*或者在Maven的pom.xml文件中直接配置如下:
net.sf.json-lib
json-lib
2.4
jdk15
json数据:
{"cartypes":[
{"id":1,"imgUrl":"img/l.jpg","bigimg": "img/d.jpg","title":"别克威朗","marketprice":"15.29","periods":"12","endrepayone":"96800","endrepaytwo":"96800","endrepaythree":"93000","endmonthone":"3408","endmonthtwo":"3408","endmonththree":"3278","repayfirst":"15290","repaytwo":"22935", "repaythree":"30580","monthrepayone":"3578","monthrepaytwo":"2878","monthrepaythree":"2478","cardetails":
[{"imageId00": "img/first-bkwl.jpg","imageId01": "img/bkwl01.jpg","imageId02": "img/bkwl02.jpg","imageId03": "img/bkwl03.jpg","imageId04": "img/bkwl04.jpg","carname": "别克","carmatter": "威朗","carvolume":"1.5L","sitnum":"5","cargearbox":"6挡手自一体","caremission":"国V","carldone":"一体式座舱","carldtwo":"绒面内饰","carldthree":"全景天窗","carldfour":"展翼型HID大灯"}]