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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:27:02+00:00 2026-06-04T08:27:02+00:00

I try to use Twitter Get users/lookup to look up users information. But I

  • 0

I try to use Twitter Get users/lookup to look up users information. But I got some error in parsing the response json file. The request URI is: “https://api.twitter.com/1/users/lookup.json?screen_name=nba”. My code is:

public String getInternetData() throws Exception{
    String data = null;
    try {
        URI website = new URI("https://api.twitter.com/1/users/lookup.json?screen_name=nba");
        HttpClient client = new DefaultHttpClient();
        HttpGet request = new HttpGet();
        request.setURI(website);
        HttpResponse response = client.execute(request);
        HttpEntity entity = response.getEntity();
        String str = EntityUtils.toString(entity);
        try {
            JSONObject jouser = new JSONObject(str);
            data = jouser.getString("followers_count");
        } catch (JSONException e) {
            e.printStackTrace();
        }

    }catch(Exception e){
        Log.e("log_tag", "Error in http connection: " +e.toString());
    }
    return data;
}

The response JSON content is

[
   {
      "notifications":false,
      "id":19923144,
      "profile_link_color":"177BC7",
      "profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1787324427\/National-Basketball-Association_normal.jpg",
      "profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/559347559\/12twitter_playoffs_0523.jpg",
      "id_str":"19923144",
      "following":false,
      "profile_use_background_image":true,
      "profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1787324427\/National-Basketball-Association_normal.jpg",
      "utc_offset":-18000,
      "friends_count":988,
      "profile_text_color":"333333",
      "time_zone":"Eastern Time (US & Canada)",
      "default_profile":false,
      "followers_count":5095414,
      "name":"NBA",
      "profile_banner_url":"https:\/\/si0.twimg.com\/brand_banners\/NBA\/1335482314\/live",
      "url":"http:\/\/www.nba.com",
      "profile_sidebar_border_color":"eeeeee",
      "created_at":"Mon Feb 02 19:04:42 +0000 2009",
      "protected":false,
      "listed_count":28499,
      "profile_background_tile":false,
      "contributors_enabled":true,
      "profile_sidebar_fill_color":"ffffff",
      "geo_enabled":false,
      "description":"News and notes directly from the NBA.",
      "location":"New York, NY",
      "is_translator":false,
      "show_all_inline_media":true,
      "statuses_count":28818,
      "follow_request_sent":false,
      "lang":"en",
      "profile_background_color":"000000",
      "default_profile_image":false,
      "verified":true,
      "favourites_count":15,
      "screen_name":"NBA",
      "profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/559347559\/12twitter_playoffs_0523.jpg"
   }
]

Then I got the error: *Error parsing data: org.json.JSONException: Value [{“location”……
Anybody has an idea?

  • 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-04T08:27:04+00:00Added an answer on June 4, 2026 at 8:27 am

    If the response starts with [ it means it is actually a JSON Array, not an object. Then, you will have to do something like this:

    JSONArray array = new JSONArray(str);
    JSONObject jsonObject = array.getJSONObject(0);
    String followersCount = jsonObject.getString("followers_count");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to use a variable in my kshell script but can't get a
I use python-twitter to get the date of a tweet and try to parse
I try use string as a regular expression pattern but I've following errors PHP
I try to use SQL SERVER VIEW within RIA Services. So I created some
i try to use TBXML and getting this error TBXML class method +tbXMLWithURL not
i try to use jquery .text() but not really work : Before <a id=group_name
I try to use this: xml2struct when I use this xml: <XMLname attrib1=Some value>
I try to use the columnFilter add-on of jquery datatable but I couldn't make
I trying to use twitter API to send direct messages using C# but Twitter
I am able to login to twitter using twitter4j and get information about the

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.