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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:03:55+00:00 2026-05-30T12:03:55+00:00

I am quite confused with JSON, I can easily take first level arrays values,

  • 0

I am quite confused with JSON, I can easily take first level arrays values, but having problem with subs.

I am using $.getJSON and code is

$.getJSON('http://www.authenticjobs.com/api/?api_key=4c4f1d5934d66ca872dfa2a0cfd3a20b&method=aj.jobs.search&perpage=3&format=json&callback=?', function(data) {
var listings = "";    

$.each(data.listings.listing, function(index, listing) {

    listings += "<li><strong>" + listing.company.name + "</strong> needs a <a href='" + listing.url + "'>" + listing.title + "</a>";

        if (listing.location != "") {
            listings += " in " + listing.location;
        }

    listings += "</li>";

});

$("#authentic-jobs ul").append(listings);

});

Visual data is here: http://cloud.ignatynikulin.com/2v0F2p2x111r0X3k4441

I can’t get company location name.

I ve tried listing.company.location.name but it’s not working and also don’t make any sense.

Thank you!

Answer will be (thank you GregL):

Since listing.company.location is a nested object (visualised by the
{} in the picture you attached), so you just want to check if the
object is not something like undefined, null or similar (what are
called “falsey values” in Javascript).

  • 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-05-30T12:03:56+00:00Added an answer on May 30, 2026 at 12:03 pm

    I think I created a jsFiddle that works here.

    The key is to use:

        if (listing.company.location) {
            listings += " in " + listing.company.location.name;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am quite confused using the Facebook application in the iframe. I granted permissions
I have recently run across these terms few times but I am quite confused
I'm quite confused about how to solve the following problem (search both on SO
I am quite confused with technique that I am using. I am using EditorFor
I'm quite confused what is secret_token used for in Rails. Can anyone explain what
I'm quite confused. I'm using the animation frames to make the objects move. Here's
I'm creating a theatre booking system. I am quite confused on how I can
I believe it's a very easy question but I'm quite confused. What I am
I'm quite confused by this one. I've build a read more button using mostly
As I was reading RedBook I stayed quite confused, that openGL can have maximum

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.