JsonObject To HashMap

前端之家收集整理的这篇文章主要介绍了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;
	}

猜你在找的Json相关文章