`

net.sf.json.JSONException: Object is null

 
阅读更多
Map agreementMap = new HashMap<String, Object>();
jsonObject = JSONObject.fromObject(agreementMap);

return SUCCESS;


如果map的value值为空,会出现上述错误

解决


	//防止json转换时为null值的错误
	private Object isNull(Object obj) {
		
		if (obj == null) {
			return "";
		}
		
		return obj;
	}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics