如果我在JSON对象中添加空值或空值,我的JSON值为true。
$scope.getUserData = function (){
$.ajax({
url: "/test.com/abc.jsp",
type: "POST",
dataType: "json",
data: {
action : "getUserData",
id : Id,
logView:"true",
},
async:false,
success: function(data){
// data is json array and userData is json object
$scope.userData = JSON.parse(data.userData);
$scope.userData.uname // comes as true but from server it is set as blank
});
});
}
在服务器端java代码中,我从数据中获取值为空/空,但在JSON对象中,对于blank / null,则为true。它在我的本地工作,但在服务器环境中,它对于blank / null是真的。