如何使用Gson将JSON转换为HashMap?
我正在从返回JSON格式数据的服务器请求数据。发出请求时,将HashMap转换为JSON并不困难,但另一种方式似乎有些棘手。JSON响应如下所示: { "header" : { "alerts" : [ { "AlertID" : "2", "TSExpires" : null, "Target" : "1", "Text" : "woot", "Type" : "1" }, { "AlertID" : "3", "TSExpires" : null, "Target" : "1", "Text" : "woot", "Type" : "1" } ], "session" : "0bc8d0835f93ac3ebbf11560b2c5be9a" }, "result" : "4be26bc400d3c" …