Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺
阿里的JSONObject 对象转化为Map对象
//json对象转为map
public Map<String,Object> JsonToMap(JSONObject json){
System.out.println("********************转Map对象******************"+json);
Map<String, Object> data =new HashMap<>();
//循环转换
System.out.println("***********************json*****************"+json);
Iterator it =json.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = (Map.Entry<String, Object>) it.next();
data.put(entry.getKey(), entry.getValue());
}
System.out.println("map对象:"+data.toString());
return data;
}
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/172456.html原文链接:https://javaforall.net