json里面包含json数组


首先需要这个依赖

<dependency>
    <groupId>net.sf.json-lib</groupId>
    <artifactId>json-lib</artifactId>
    <version>2.4</version>
    <classifier>jdk15</classifier>
</dependency>

 

然后需要引入两个包

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

 

下面就是代码例子

JSONObject jsonParam = new JSONObject();
JSONArray array
= new JSONArray(); for(PPayOrderBill bill:pPayOrderBillList){ jsonParam.put("receivableId",bill.getBillId()); array.add(jsonParam); } JSONObject object = new JSONObject(); if(pPayOrderResult != null && params != null) { object.put("paymentId",pPayOrderResult.getGuid()); object.put("houseId", pPayOrderResult.getHourceGuid()); object.put("paymentList", array); }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM