看調試狀態下的對象
直接轉Json失敗
JSONArray jsonArray = new JSONArray();
ArrayList arrayList = (ArrayList) exchange.getIn().getBody();
for (int i = 0; i < arrayList.size(); i++) {
if(arrayList.get(i) != null){
byte[] bytes = (byte[]) ((LinkedHashMap) arrayList.get(i)).get("TBLOB");
String blob = new String(bytes);
JSONObject tblob = new JSONObject();
tblob.put("tblob", blob);
jsonArray.add(tblob);
}
}
System.out.println(jsonArray);
打印:[{"tblob":"1blob"},{"tblob":"tblob"}]