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 8672963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:20:02+00:00 2026-06-12T19:20:02+00:00

I can’t see to access the deepest values in my json object. It’s an

  • 0

I can’t see to access the deepest values in my json object. It’s an array of images and it reads:

{
   "imgs":[
      {
         "Landscape":{
            "2":"DSCF2719.jpg",
            "3":"DSCF2775.jpg",
            "4":"IMG_1586.jpg",
            "5":"Red Rose.jpg",
            "6":"untitled030617.jpg",
            "7":"untitled071756.jpg",
            "8":"untitled170744.jpg",
            "9":"untitled170907.jpg",
            "10":"untitled235450.jpg"
         }
      },
      {
         "People":{
            "2":"IMG_0775.jpg",
            "3":"untitled011003.jpg",
            "4":"untitled011809.jpg",
            "5":"untitled024716.jpg",
            "6":"untitled114229.jpg",
            "7":"untitled120704-1.jpg",
            "8":"untitled120704.jpg",
            "9":"untitled203242.jpg",
            "10":"untitled222816.jpg",
            "11":"untitled231442-2.jpg"
         }
      },
      {
         "Still Life":{
            "2":"DSCF2769.jpg",
            "3":"untitled001620.jpg",
            "4":"untitled010832.jpg",
            "5":"untitled112413.jpg",
            "6":"untitled152613.jpg",
            "7":"untitled232940.jpg"
         }
      },
      {
         "Test":{
            "2":"DSCF2719.jpg",
            "3":"DSCF2769.jpg",
            "4":"DSCF2775.jpg",
            "5":"IMG_0775.jpg",
            "6":"IMG_1586.jpg",
            "7":"Red Rose.jpg",
            "8":"untitled001620.jpg",
            "9":"untitled010832.jpg",
            "10":"untitled011003.jpg",
            "11":"untitled011809.jpg",
            "12":"untitled024716.jpg",
            "13":"untitled030617.jpg",
            "14":"untitled071756.jpg",
            "15":"untitled112413.jpg",
            "16":"untitled114229.jpg",
            "17":"untitled120704.jpg",
            "18":"untitled152613.jpg",
            "19":"untitled170744.jpg",
            "20":"untitled203242.jpg",
            "21":"untitled222816.jpg",
            "22":"untitled231442-2.jpg",
            "23":"untitled232940.jpg",
            "24":"untitled235450.jpg"
         }
      }
   ],
   "cats":[
      "Landscape",
      "People",
      "Still Life",
      "Test"
   ]
}

I can access all except the deepest set with:

// accessed with $.ajax()
var obj = $.parseJSON(msg)
console.log(obj.cats[0]) // "Landscape"
console.log(obj.imgs[0][5]) // undefined
console.log(obj.imgs.length) // "3"

I’ve also tried without the associative aspect in the deepest level, with just "DSCF2719.jpg", instead of "2":"DSCF2719.jpg",

I can’t seem to find this on the net. What am I missing?

  • 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-12T19:20:04+00:00Added an answer on June 12, 2026 at 7:20 pm

    Each group is nested in an object under a category like Landscape, People, but since the individual images are numeric properties, they will need to be accessed with [] rather than the more usual JavaScript dot property notation.

    // imgs is an Array, numerically indexed like [0]
    // Landscape is an object in the first imgs element accessed via .Landscape
    // 2 is a property of the Landscape object, but must be accessed with [2]
    console.log(obj.imgs[0].Landscape[2]);
    // "DSCF2719.jpg"
    
    console.log(obj.imgs[0].People[6]); 
    // "untitled114229.jpg"
    

    The last property cats of your outer object is just an array, accessed via numeric indices:

    console.log(obj.cats[0]);
    // Landscape
    

    Edit: To get the images in a loop:

    // Loops over imgs
    for (var i=0; i<obj.imgs.length; i++) {
      var catName = obj.cats[i]; // Landscape, People, etc...
      // Use catName inside []
      // and a for-in loop to get the subsequent numeric properties
      for (var imgNum in obj.imgs[i][catName]) {
        console.log(obj.imgs[i][catName][imgNum]);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please explain why this doesn't work? MyClass myClass1 = new MyClass(); object
Can anyone give me an example of how to return the following json simply
Can i call a Method on the Thread Object ??
Can someone access the database files and/or other files of my app stores in
Can I somehow see the types and size of the contents of a tuple?
Can anyone let me know how can we change the value of kendo combobox
Can I order my users in the database, so I don't have to say
Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can I authenticate with just Google account username and password instead of using OAuth?
Can any one tell, how to get the result of LINQ query contains group

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.