AJAX JSON解析返回false

I am using jquery and javascript, with an ajax call to get all the information from a json file. The json file loads fine, and perfectly adds the points to the map, but there is still an error in the console.

"TypeError: obj[i].info is null"

Even though every point is inserted correctly and has the "info" attribute inside them, why does jquery give it a null value?

Example code:

$.ajax({
    url: 'http://localhost:3000/api/',
    type: 'GET',
    dataType: 'html',
}).success(function(data){
    var obj = $.parseJSON(data);
        console.log(obj);
        $.each(obj, function(i, item){
            taxiData.push(new google.maps.LatLng(obj[i].info.latitude,obj[i].info.longitude));
        });

}).error(function(data){
    console.log("Error with data: " + data);
});

My JSON:

[{
        "id" : 1,
        "ip" : "165.242.13.8",
        "referer" : "www.facebook.com",

        "info" : {
            "request" : "165.242.13.8",
            "ip" : "165.242.13.8",
            "country_code2" : "JP",
            "country_code3" : "JPN",
            "country_name" : "Japan",
            "continent_code" : "AS",
            "region_name" : "11",
            "city_name" : "Hiroshima",
            "postal_code" : "",
            "latitude" : 34.3963,
            "longitude" : 132.45940000000002,
            "dma_code" : null,
            "area_code" : null,
            "timezone" : "Asia/Tokyo"
        }
    }
]

You are using $.each wrong.

each already takes each entry and gives it to you as the item.

use:

$.each(obj, function(i, item){
            taxiData.push(new google.maps.LatLng(item.info.latitude,item.info.longitude));
        }); //Notice I don,t access the obj Object

Firstly, you can set

dataType : "json"

and don't do

var obj = $.parseJSON(data);

your data will already be an object

Secondly, this code works

console.log(obj);
$.each(obj, function(i, item){
    console.log(obj[i].info.latitude);
    console.log(obj[i].info.longitude);
    console.log(item.info.latitude);
    console.log(item.info.longitude);
});

item === obj[i]

try this:

$.ajax({
    url : 'http://localhost:3000/api/',
    type : 'GET',
    dataType : 'json',
}).success(function (data) {
    var obj = data;
    console.log(obj);
    $.each(obj, function (i, item) {
        var pushString = item.info.latitude + ',' + item.info.longitude;
        var googleLatLong = new google.maps.LatLng(pushString);
        taxiData.push(googleLatLong);
    });
}).error(function (data) {
    console.log("Error with data: " + data);
});