赞
踩
public static String toString(List<Map<String,Object>> list){
String str ="[";
if(list.size()>0) {
for (int i = 0; i < list.size(); i++) {
String mp = "";
if(i==0){
int num = 0;
Map<String, Object> map = list.get(i);
for (Object key : map.keySet()) {
num = num+1;
if(num==1){
mp = mp+"{\"" + key.toString() + "\" :\"" + map.get(key)+"\"";
}else {
mp = mp + ",\""+key.toString() + "\" :\"" + map.get(key)+"\"";
}
}
mp=mp+"}";
}else{
int num = 0;
Map<String, Object> map = list.get(i);
for (Object key : map.keySet()) {
num = num+1;
if(num==1){
mp = mp +",{\""+ key.toString() + "\" :\"" + map.get(key)+"\"";
}else {
mp = mp + ",\""+key.toString() + "\" :\"" + map.get(key)+"\"";
}
}
mp=mp+"}";
}
str=str+mp;
}
}
str=str+"]";
return str;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。