if(xnxqList!=null && xnxqList.size()>0){
String xnxq="";
for (int i = 0; i < xnxqList.size(); i++) {
Object[] object = (Object[]) xnxqList.get(i);
xnxq+="{\"xnxq\":\""+object[0].toString()+"\"},";
}
xnxq=xnxq.substring(0,xnxq.length()-1);
xnxq="["+xnxq+"]";
System.out.println(xnxq);
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
PrintWriter out = null;
try {
out = response.getWriter();
out.write(xnxq);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
out.close();
}
}
}
转载于:https://www.cnblogs.com/itniwota/p/6674535.html