/**
*
* @param record
* @return HashMap 用于将JSONObject转化为HashMap
*/
public HashMap
<String, String
> changeToMap
(JSONObject record, String name
) {
HashMap
<String, String
> map
= new HashMap
<String, String
>();
map.put
("name", name
);
try
{
@SuppressWarnings
("rawtypes")
Iterator it
= record.keys
(); // 迭代器
// 遍历jsonObject数据,添加到Map对象
while (it.hasNext
()) {
String key
= String.valueOf
(it.next
()).toString
();
String value
= (String
) record.get
(key
).toString
();
map.put
(key, value
);
}
} catch
(Exception e
) {
// TODO: handle exception
e.printStackTrace
();
}
return map
;
}