开发者

JSON nested object output problem in a YQL query

I am trying to use this function to pull data from Foursquare through yahoo query lang. I can get results but, i can't get the nested primarycategory objects results. It gives me [object object]. If i try to use it as a variable, then function fails with a unidentified object. I am a newbie, may be this is a stupid question but how can i get this results too...

function fsqpoints(o)
        {
            var venues = o.query.results.venues.group.venue;
            var output = '';
            for(var i=0,j=venues.length;i<j;i++) {
                var cur = venues[i]
                 var id = cur.id;
                var path = cur.primarycategory;
                  var address = cur.address;
                  var name = cur.name;  
            开发者_JAVA技巧      output += "<h3><a href='http://foursquare.com/venue/" + id + "'>"+name+"</a></h3>" + address + "," + path + "<hr/>";    }    

                document.getElementById('results').innerHTML = output;


Try name.text().toString() instead of just "name". The same applies to all other nodes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜