public String toJson (HashMap params) {
String url ="";
String urls ="";
if(params !=null) {
Iterator it = params.keySet().iterator();
StringBuffer sb =null;
while(it.hasNext()) {
String key = it.next();
String value = params.get(key);
if(sb ==null) {
sb =newStringBuffer();
sb.append("{");
}else{
sb.append(",");
}
sb.append("\"");
sb.append(key);
sb.append("\"");
sb.append(":");
sb.append("\"");
sb.append(value);
sb.append("\"");
}
url += sb.toString();
}
urls=url+"}";
returnurls;
}
网友评论