简体   繁体   中英

Parse response from API

Sorry if this looks like simple but please help me finding a solution.

When I call an API it returns response and I need to find "Latitude" and "Longitude" values from it. I am not able to make it work. I use JQuery/JavaScript.

Response form API:

{"Data":[{"DeviceName":"HAY-JOVAN-5103657285","DeviceID":"10941818","Date":"2015-08-12T17:02:42-07:00","Latitude":37.65438,"Longitude":-122.13830,"Type":"GPS","Speed(mph)":0,"Speed(km/h)":0,"Altitude(ft)":-82,"Altitude(m)":-25,"Accuracy":11}]}

When tried something like this but not what I want:

$.each(jsonResult, function () {
                    $.each(this, function (k, v) {
                        console.log("k:" + k, " v:" + v);
                    });
                });

Can you please help me finding "Latitude" and "Longitude" values from it?

Just try with:

console.log('Latitude', v.Latitude);
console.log('Longitude', v.Longitude);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM