前端之家收集整理的这篇文章主要介绍了
JsonObject To HashMap,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
public static HashMap<String,Object> jsonToMap(JSONObject object) {
HashMap<String,Object> jsonMap = new HashMap<String,Object>();
Iterator<String> keyIter = object.keys();
String key;
Object value;
while (keyIter.hasNext()) {
try {
key = (String) keyIter.next();
value = object.get(key);
jsonMap.put(key,value);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return jsonMap;
}
原文链接:https://www.f2er.com/json/289866.html