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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:37:07+00:00 2026-05-28T04:37:07+00:00

I am trying to figure out how to properly parse some values returned from

  • 0

I am trying to figure out how to properly parse some values returned from the linkedIn JavaScript API.

At present I am using the following code to loop through and print the objects returned.

for(var position in profile.positions)
{
    profHTML = profHTML + profile.positions[position];
}

The result (which is getting me part of the way to figuring it out is:

 11[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Essentially its the # of objects (which seems to be the first thing returned) and then each of the objects.

According to what is returned when I do a console log in Chrome this code is returning an array of objects which contain an object named “company”. Company contains 4 attributes (“id”,”industry”,”name”,”type”)

I gather that profile.positions[position] is the reference to the element returned however I am not sure of the syntax to access the company object and attribute while looping.

I am also not sure what would be the best practice to avoid trying to reference the field on the very first loop which returns the number of objects.

Thanks in advance for your help.

  • 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-28T04:37:08+00:00Added an answer on May 28, 2026 at 4:37 am

    To start, use a regular for loop, not a for...in loop, to iterate over an array.

    var positions = profile.positions,
        position;
    
    for(var i=0; i<positions.length; i++)
    {
        position = positions[i];
        profHTML = profHTML + position;
    }
    

    Now, to access one of the properties of the position, just use a member operator (. or []):

    var positions = profile.positions,
        company;
    
    for(var i=0; i<positions.length; i++)
    {
        company = positions[i].company;
        console.log(company.id, company.industry, company.name, company.type);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse some html to switch out values of various element
I'm trying figure out how to compare decimal values in PHP properly. $get_decimal_value =
I'm trying to figure out how to properly serialize my XmlDocument and send it
Trying to figure out this pseudo code. The following is assumed.... I can only
I've been trying to figure out how to properly accommodate how to handle 'Identity'
I am having a hard time trying to figure out how to properly select
I am trying to figure out how to properly setup my crossdomain file. Here
I've been trying to figure out how to properly setup DreamWeaver in such a
I'm trying to figure out how to properly store foreign keys when the key
I'm trying to figure out where to properly set tableView.rowHeight. Currently I have it

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.