http://cloudyxuq.iteye.com/blog/1618213

 

  1.   private static HashMap<String, String> toHashMap(Object object)  
  2.    {  
  3.        HashMap<String, String> data = new HashMap<String, String>();  
  4.        // 将json字符串转换成jsonObject  
  5.        JSONObject jsonObject = JSONObject.fromObject(object);  
  6.        Iterator it = jsonObject.keys();  
  7.        // 遍历jsonObject数据,添加到Map对象  
  8.        while (it.hasNext())  
  9.        {  
  10.            String key = String.valueOf(it.next());  
  11.            String value = (String) jsonObject.get(key);  
  12.            data.put(key, value);  
  13.        }  
  14.        return data;  
  15.    }  

相关文章:

  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-02-26
  • 2021-08-30
  • 2021-06-10
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-11
  • 2022-12-23
  • 2021-06-20
相关资源
相似解决方案