java_method_下拉框成json

时间:2023-01-14 05:57:48

List<String[]> proList=service.getUserList();

int nTotal=0;
String proJson="[";
proJson+="{\"userID\":\"\",\"loginID\":\"全部\"},";
if(proList!=null&&proList.size()>0){
nTotal=proList.size();
String[] strsProvince=null;
for (int i = 0; i < nTotal; i++) {
strsProvince=proList.get(i);
proJson+="{\"userID\":\""+StringUtils.isNull(strsProvince[0])+"\","
+"\"loginID\":\""+StringUtils.isNull(strsProvince[1])+"\"}";
if(i<(nTotal-1)){
proJson+=",";
}
}
}
proJson+="]";