/**
* json to map
* @param str
* @return
*/
public static Map<String, String> getParamsMap(String str) {
if(StringUtils.isEmpty(str)) return null;
Map<String, String> paramsMap = new LinkedHashMap<String, String>();
str = str.substring(1, str.length()-1);
str = str.replaceAll("\"", "");
String[] strs = str.split(",");
for(String parm : strs) {
int splitIndex = parm.indexOf(":");
String key = parm.substring(0, splitIndex);
String value = parm.substring(splitIndex + 1, parm.length());
paramsMap.put(key, value);
}
return paramsMap;
}
JAVA简单结构JSON截成MAP
最新推荐文章于 2022-08-17 18:46:23 发布