处理后端传来的json数组,弹出json数组中DeviceID值,显示undefined

处理后端传来的json数组,弹出json数组中DeviceID值,显示undefined
json:

img

前端js代码:


function findAll(){

        $.ajax({
            url: '/baidumap/findalldevice',
            type: "post",
            contentType: "application/json;charset=utf-8",
            dataType: "json", //表示返回值类型,不必须
            //  traditional: true,
            success:succFunction,//响应成功后的回调函数
            error:errorfunction
        });
        function succFunction(data) {
            alert(data);
            var jsonLength = 0;
            for(var item in data){
                jsonLength++;//计算json数组长度
            }
            for(var i=0;i<jsonLength;i++)
            {
                var DeviceID=data[i].DeviceID;//取出DeviceID
                alert(DeviceID);
            }   
}
        function errorfunction(){
            alert("出错了");
        }
    }

我弹出alert(data);可以弹出

img

但是弹出json数组中DeviceID值,显示undefined

img


麻烦看一下。

d小写deviceID

DeviceID写错了,应为deviceID