I am using YQL query.multi to capture many feeds so that I parsed a JSON feed with jQuery I can make and reduce the number of connections I'm making To parse the same feed, I should be able to check the type of result (photos, items, entry, etc.) so that I can remove items in a specific way . Due to the goodness of the item within the JSN feed, I am not sure that through the result, check the loop best method and type and then display it to display the item.
Here is a YQL () query.multi example and you can see three different result types (entries, photos, and items) and then see nested items within them:
< Select from query> query * Select from Twitter.user.timeline * Select ID = 'Twitter' * Select * from Flickr.photos.search, where is_goose = 'true' and select text = 'san francisco'; Choose tasty. Feeds from Popular.Or here's the only JSON feed:
http://query.yahooapis.com/v1/ Public / yql? Q = select% 20 *% 20 From% 20query.multi% 20where% 20queries% 3d% 22select% 20 *% 20from% 20flickr.photos.search% 20where% 20user_id% 3D'23433895% 40N00 '% 3Bselect% 20 *% 20from% 20delicious.feeds% 20where% 20username% 3D'keith.muth '% 3Bselect% 20 *% 20from% 20twitter.user.timeline% 20where% 20id% 3D'kitmuth'% 22and format = json & amp; en = store% 3A% 2F% 2Fdatatables.org% 2Falltableswithkeys and callback =
I am using jQuery's $ .getJSON method
You do not need to parse Jason with your hands. It is a matter of JSON Use JSON.parse (yourJSONstring)
in a javascript object To change.
Edit: Actually I'm not sure that support for that browser. Here's the way of jQuery:
Edit2:
var for results = feedObj.query.results.results (var i = 0; I & lt; Results.length; i ++) {if (result [i] .photo) {// do something with photos} and if (result [i] .item) {// do something with item} Else {// do not entry}}
test [i] .photo
test for the existence of the object. If this is present, then the result is an array that can loop through you and do something with it.
Comments
Post a Comment