JSON数组转换为List对象

public static void main(String[] args) {

String recipt_list_json = "[{'partner':'00001','partner_fund_no':'0002','sp_user':'test','transaction_id':'12345678','out_trade_no':'77777','receipt_name':'回单','attach':'aaaaa'},{'partner':'00003','partner_fund_no':'0004','sp_user':'test1','transaction_id':'12345678','out_trade_no':'77777','receipt_name':'回单','attach':'aaaaa'}]";

JSONArray jsonArray = JSONArray.fromObject(recipt_list_json); 

 

List list =   (List) JSONArray.toCollection(jsonArray,ReceiptListRequestBean.class);

for (ReceiptListRequestBean receiptList:list) {

System.out.println(receiptList.getSp_user());

}

 

 

 

 

}

你可能感兴趣的:(JSON数组转换为List对象)