0

I am looking to grab some information from the data twitter provides. Im looking to extract all the screen names that come out of this object.

   T.get('followers/list', { screen_name: 'screenname' },  function (err, data, response) {
    console.log(data);
   });

You will receive this in the object :

   { users:
      [ { id: 1234,
          id_str: '1234',
          name: 'Name',
          screen_name: 'screenName123',
          location: '....',
          profile_location: null,
          description: '....',
          url: '...',
          entities: [Object],
          protected: false,
          followers_count: 1751,
          friends_count: 2001,
          .
          .
          .
          .
          . } ] }

How can I abstract just screen_name out of this object. data.users.screen_name returns undefined.

1 Answer 1

2

As you can see from the console output, data.users is an array. So if you want the screen_name of the first element then just use: data.users[0].screen_name

Sign up to request clarification or add additional context in comments.

1 Comment

thank you that helped me allot. missed that array;) was driving me mental.. cheers!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.