JSONObject轉換Int類型--java.lang.Integer cannot be cast to java.lang.String

參數java

params={"abc":0}

 

JSONObject轉換Int類型json

                 JSONObject json = JSONObject.fromObject(params);
		 if (json.containsKey("desgin_review_type")) {			 			  
			 value=json.getInt("abc")+"";
		 }
		 }

 運行錯誤寫法<java.lang.Integer cannot be cast to java.lang.String>spa

			String value = ";
			Map<String, String> map = JSONObject.fromObject(params);
			if (map.containsKey("abc")) {
				value = map.get("abc").toString();
			}
相關文章
相關標籤/搜索