import net.sf.json.JSONObject;
/**
* 获取所有的用户分组* @param token
* @return
*/
public static WxGroups getGroups(String token){
String url = GROUPS_GET_URL + token;
JSONObject jsonObj = get(url);
WxGroups wxGroups=null;
if (jsonObj != null) {
@SuppressWarnings("rawtypes")
Map<String,Class> mapClass = new HashMap<String,Class>();
mapClass.put("groups",Group.class);
wxGroups = (WxGroups)JSONObject.toBean(jsonObj,WxGroups.class,mapClass);
}
return wxGroups;
}
注释:不加mapClass的话,会报异常MorphDynaBean cannot be cast
参考帖子:http://www.111cn.net/jsp/Jsp-Servlet/41930.htm
原文链接:https://www.f2er.com/json/289388.html