I am getting an incomplete Json from twitter API in Android


#1

Hey guys! I’m trying to make a twitter feed reader in Android but I’m getting a problem.

This is a part of my code :

//Getting the data from the twitter api
HttpClient httpclient = new DefaultHttpClient();
//Append twitter count and screen name with api URL
HttpGet httpget = new HttpGet(“https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi&count=2”);
//Append bearer token here.
httpget.setHeader(“Authorization”, "Bearer "+ token);
HttpResponse response2 = httpclient.execute(httpget);

HttpEntity entity = response2.getEntity();
// String result = EntityUtils.toString(entity);

  InputStream content = entity.getContent();
						  
 StringBuilder builder = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(content));
String line;
	while ((line = reader.readLine()) != null) {
	builder.append(line);
	 }
					        
 System.out.println(builder.toString());

I should get a correct JSON with that code, but instead, I get this :

[
{
“created_at”: “Thu Mar 27 20:10:19 +0000 2014”,
“id”: 449277253860352000,
“id_str”: “449277253860352000”,
“text”: “RT @TwitterDev: Streaming API will be “replaying” some Tweets starting at 1PM (Pacific) today. https://t.co/YkpeBC8ixZ”,
“source”: “web”,
“truncated”: false,
“in_reply_to_status_id”: null,
“in_reply_to_status_id_str”: null,
“in_reply_to_user_id”: null,
“in_reply_to_user_id_str”: null,
“in_reply_to_screen_name”: null,
“user”: {
“id”: 6253282,
“id_str”: “6253282”,
“name”: “Twitter API”,
“screen_name”: “twitterapi”,
“location”: “San Francisco, CA”,
“description”: “The Real Twitter API. I tweet about API changes, service issues and happily answer questions about Twitter and our API. Don’t get an answer? It’s on my website.”,
“url”: “http://t.co/78pYTvWfJd”,
“entities”: {
“url”: {
“urls”: [
{
“url”: “http://t.co/78pYTvWfJd”,
“expanded_url”: “http://dev.twitter.com”,
“display_url”: “dev.twitter.com”,
“indices”: [
0,
22
]
}
]
},
“description”: {
“urls”: [

                ]
            }
        },
        "protected": false,
        "followers_count": 2106712,
        "friends_count": 46,
        "listed_count": 12572,
        "created_at": "Wed May 23 06:01:13 +0000 2007",
        "favourites_count": 27,
        "utc_offset": -25200,
        "time_zone": "Pacific Time (US & Canada)",
        "geo_enabled": true,
        "verified": true,
        "statuses_count": 3485,
        "lang": "en",
        "contributors_enabled": false,
        "is_translator": false,
        "is_translation_enabled": false,
        "profile_background_color": "C0DEED",
        "profile_background_image_url": "http:\/\/pbs.twimg.com\/profile_background_images\/656927849\/miyt9dpjz77sc0w3d4vj.png",
        "profile_background_image_url_https": "https:\/\/pbs.twimg.com\/profile_background_images\/656927849\/miyt9dpjz77sc0w3d4vj.png",
        "profile_background_tile": true,
        "profile_image_url": "http:\/\/pbs.twimg.com\/profile_images\/2284174872\/7df3h38zabcvjylnyfe3_normal.png",
        "profile_image_url_https": "https:\/\/pbs.twimg.com\/profile_images\/2284174872\/7df3h38zabcvjylnyfe3_normal.png",
        "profile_banner_url": "https:\/\/pbs.twimg.com\/profile_banners\/6253282\/1347394302",
        "profile_link_color": "0084B4",
        "profile_sidebar_border_color": "C0DEED",
        "profile_sidebar_fill_color": "DDEEF6",
        "profile_text_color": "333333",
        "profile_use_background_image": true,
        "default_profile": false,
        "default_profile_image": false,
        "following": null,
        "follow_request_sent": null,
        "notifications": null
    },
    "geo": null,
    "coordinates": null,
    "place": null,
    "contributors": null,
    "retweeted_status": {
        "created_at": "Thu Mar 27 19:32:51 +0000 2014",
        "id": 449267825870262272,
        "id_str": "449267825870262272",
        "text": "Streaming API will be \"replaying\" some Tweets starting at 1PM (Pacific) today. https:\/\/t.co\/YkpeBC8ixZ",
        "source": "\u003ca href=\"https:\/\/about.twitter.com\/products\/tweetdeck\" rel=\"nofollow\"\u003eTweetDeck\u003c\/a\u003e",
        "truncated": false,
        "in_reply_to_status_id": null,
        "in_reply_to_status_id_str": null,
        "in_reply_to_user_id": null,
        "in_reply_to_user_id_str": null,
        "in_reply_to_screen_name": null,
        "user": {
            "id": 2244994945,
            "id_str": "2244994945",
            "name": "TwitterDev",
            "screen_name": "TwitterDev",
            "location": "Internet",
            "description": "Developers and Platform Relations @Twitter. We are developers advocates. We can't answer all your questions, but we listen to all of them!",
            "url": "https:\/\/t.co\/66w26cua1O",
            "entities": {
                "url": {
                    "urls": [
                        {
                            "url": "https:\/\/t.co\/66w26cua1O",
                            "expanded_url": "https:\/\/dev.twitter.com\/",
                            "display_url": "dev.twitter.com",
                            "indices": [
                                0,
                                23
                            ]
                        }
                    ]
                },
                "description": {
                    "urls": [
                        
                    ]
                }
            },
            "protected": false,
            "followers_count": 2942,
            "friends_count": 908,
            "listed_count": 50,
            "created_at": "Sat Dec 14 04:35:55 +0000 2013",
            "favourites_count": 60,
            "utc_offset": -25200,
            "time_zone": "Pacific Time (US & Canada)",
            "geo_enabled": false,
            "verified": true,
            "statuses_count": 199,
            "lang": "en",
            "contributors_enabled": false,
            "is_translator": false,
            "is_translation_enabled": false,
            "profile_background_color": "FFFFFF",
            "profile_background_image_url": "http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png",
            "profile_background_image_url_https": "https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png",
            "profile_background_tile": false,
            "profile_image_url": "http:\/\/pbs.twimg.com\/profile_images\/431949550836662272\/A6Ck-0Gx_normal.png",
            "profile_image_url_https": "https:\/\/pbs.twimg.com\/profil

that is all I get, as you can see, is incomplete, what may be happening?
Thanks for your time