例如这个feeBlockList
我想取到里面的fee
首先,要知道这是一个循环结构,那么feeBlockList就是一个JSONArray(import com.alibaba.fastjson.JSONArray;)
通过
String feeBlockList = datadliveID.getString("feeBlockList");
JSONArray feeBlockList1 =JSONArray.parseArray(feeBlockList);
就可以取到整个循环体的值
在进一步用循环取取值就好
for(int k=0;k<feeBlockList1.size();k++) {
JSONObject temp = (JSONObject) feeBlockList1.get(k);
// Float preOrderFee = Float.valueOf(temp.getString("preOrderFee"));
if(!temp.getString("type").equals("0")&!temp.getString("type").equals("1")&!temp.getString("type").equals("4001")){
ConsumablesCost = ConsumablesCost+ Float.valueOf(temp.getString("fee"));
}
}