Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7721231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:52:19+00:00 2026-06-01T03:52:19+00:00

I have a function hitting a JSON file, and I am trying to get

  • 0

I have a function hitting a JSON file, and I am trying to get the url of the photos out of the JSON file but I can’t seem to drill down far enough into the file to get them?

Here is the function:

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);
            }
        } 
    });

};

Here is what the JSON looks like, or the part I am focusing on, i am trying to get the photos.items[1] which are the photos with WxH = 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"
          }
        },
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:52:20+00:00Added an answer on June 1, 2026 at 3:52 am
    • demo: http://jsbin.com/urudul
    $(function () {
       var pics = [];
       var json_source = 'https://api.foursquare.com/v2/users/...';
        $.getJSON(json_source, function (results) {
            $.each(results.response.checkins.items, function (i, item) {
                if (item.photos.count > 0) {
                    $.each(item.photos.items, function (i, photo) {
                        pics.push(photo.url);
                    });
                }
            });
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSON request, but it seems that it is not hitting the
I've been trying to troubleshoot this, but can't find a good function that will
I have been hitting my head against the wall trying to figure this out
What I would like to do is have a function that I can repeatedly
I am trying to read a json file at localhost. it is not read
i have function public Menu Details(int? id) { return _dataContext.Menu.Include(ChildMenu).FirstOrDefault(m => m.MenuId == id);
I have function: char *zap(char *ar) { char pie[100] = INSERT INTO test (nazwa,
I have function getCartItems in cart.js and I want to call that function in
I have function Start() that is fired on ready. When I click on .ExampleClick
I have function some_func_1 which will create an object of type some_type and will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.