私はJSONファイルにヒットする関数を持っています。私はJSONファイルから写真のURLを取得しようとしていますが、それらを取得するために十分遠くにドリルダウンすることはできません。ここでjQueryを使用してJSONファイルを解析しますか?
が関数である:ここでは
var pics = [];
function jsonData(){
$.ajax({
url: "https://api.foursquare.com/v2/users/self/checkins?oauth_token=FUKXDJRWIB0AQ2MQUKUEUSB3KW2TMYKUMFGYLYUHBBH14CQ0&v=20120126",
cache: false,
dataType: 'json',
success: function(results) {
var lat;
var long;
var paths = [];
for(var i = 0; i < results.response.checkins.items.length; i++) {
var pic = results.response.checkins.items[i].photos.items[0].sizes.items[0];
pics.push(pic);
}
}
});
};
は、JSONのように見えるものであるか、私はに焦点を当てています一部、私はphotos.itemsを取得しようとしています[1]幅x高で写真であります= 300:
{
"meta": {
"code": 200
},
"notifications": [
{
"type": "notificationTray",
"item": {}
}
],
"response": {
"checkins": {
"count": 1385,
"items": [
{
"id": "4f71b513e4b0684643f7929e",
"createdAt": 1332851987,
"type": "checkin",
"shout": "Fish are still alive",
"timeZone": "America/New_York",
"timeZoneOffset": -240,
"venue": {},
"photos": {
"count": 1,
"items": [
{
"id": "4f71b515e4b0559c393d50dc",
"createdAt": 1332851989,
"url": "https://is1.4sqi.net/pix/t3wej3CK8o3DbJrpOZKYtO6ps1UNMZ05jr0T_BxPBX0.jpg",
"sizes": {
"count": 4,
"items": [
{
"url": "https://is1.4sqi.net/pix/t3wej3CK8o3DbJrpOZKYtO6ps1UNMZ05jr0T_BxPBX0.jpg",
"width": 720,
"height": 537
},
{
"url": "https://is0.4sqi.net/derived_pix/t3wej3CK8o3DbJrpOZKYtO6ps1UNMZ05jr0T_BxPBX0_300x300.jpg",
"width": 300,
"height": 300
},
{
"url": "https://is0.4sqi.net/derived_pix/t3wej3CK8o3DbJrpOZKYtO6ps1UNMZ05jr0T_BxPBX0_100x100.jpg",
"width": 100,
"height": 100
},
{
"url": "https://is0.4sqi.net/derived_pix/t3wej3CK8o3DbJrpOZKYtO6ps1UNMZ05jr0T_BxPBX0_36x36.jpg",
"width": 36,
"height": 36
}
]
},
"source": {
"name": "foursquare for iPhone",
"url": "https://foursquare.com/download/#/iphone"
},
"user": {
"id": "43",
"firstName": "christian",
"lastName": "bovine",
"photo": "https://is1.4sqi.net/userpix_thumbs/AN3FGD1WOWXA4S2F.jpg",
"gender": "male",
"homeCity": "New York, NY",
"canonicalUrl": "https://foursquare.com/xtianbovine",
"relationship": "self"
},
"visibility": "public"
}
]
},
"comments": {
"count": 0,
"items": []
},
"source": {
"name": "foursquare for iPhone",
"url": "https://foursquare.com/download/#/iphone"
}
},