Get single value from JSON object

后端 未结 3 1657
醉酒成梦
醉酒成梦 2021-01-29 06:29

I am using Google Maps API with jQuery getJSON:

$.getJSON(requestUrl, function(data) {
        var distance = //need to parse value from \'data\' object here
            


        
3条回答
  •  花落未央
    2021-01-29 07:03

    var json = JSON.parse(data);
    distance= json["rows"]["elements"]["distance"]["text"];
    

    Hope it helps

提交回复
热议问题