I am trying to access specific values from a JSON file by the key lat as I loop through each record. However I have been getting undefined result as I printed them.
JSON
[{"pid":4317129482,"lat":"51.5078","lon":"-0.10467","coords":{"x":-0.10467,"y":51.5078},"points":{"x":-0.10467,"y":51.5078}},
{"pid":4356791546,"lat":"51.522","lon":"-0.101773","coords":{"x":-0.101773,"y":51.522},"points":{"x":-0.101773,"y":51.522}},
The JSON is stored in data
Code attempted
$.each(data, function(key, value){
if (key == "lat") {
console.log(value)
}
OR
$.each(data, function(item){
console.log(item.lat)
}