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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:40:10+00:00 2026-05-18T10:40:10+00:00

I’ve seen quite a few people having trouble with the GSON library – I

  • 0

I’ve seen quite a few people having trouble with the GSON library – I still couldn’t find a solution to my problem.

What I’m trying to achieve is to parse JSON from Twitter’s public timeline into a POJO with GSON.

The following is my representation of twitter’s JSON structure:

public class OneTweet {


public OneTweet()
{
    // Empty constructor
}


public String coordinates;
public String favorited;
public String created_at;
public String truncated;
public String text;
public String contributors;
public String id;
public String geo;
public String in_reply_to_user_id;
public String place;
public String in_reply_to_screen_name;
//public user user;

public List<user> user;


public String source;
public String something;


}

public class user {

public String name;
public String profile_sidebar_border_color;
public String profile_background_tile;
public String profile_sidebar_fill_color;
public String created_at;
public String profile_image_url;
public String location;
public String profile_link_color;
public String follow_request_sent;
public String url;
public String favourites_count;
public String contributors_enabled;
public String utc_offset;
public String id;
public String profile_use_background_image;
public String profile_text_color;

// protected is a reserved identifier
public String pprotected;

public String followers_count;
public String lang;
public String notifications;
public String time_zone;
public String verified;
public String profile_background_color;
public String geo_enabled;
public String description;
public String friends_count;
public String statuses_count;
public String profile_background_image_url;
public String following;
public String in_reply_to_status_id;
public String screen_name;

 }

Map<String, OneTweet> json_string_array = googlejson.fromJson(jsonstring, new TypeToken<Map<String, OneTweet>>(){}.getType());

I currently get the following error:

Exception in thread “main” com.google.gson.JsonParseException: Expecting object found: false

I’m guessing either my POJO structure is wrong or maybe it has to do with the fact that the JSON object “protected” is a protected identifier in Java. If the latter is the case I wouldn’t know how to fix it.

  • 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-18T10:40:10+00:00Added an answer on May 18, 2026 at 10:40 am

    Why reinvent the wheel? You can use twitter4j. It does all the parsing, and gives you the needed objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I've tracked down a weird MySQL problem to the two different ways I was
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have been unable to fix a problem with Java Unicode and encoding. The
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
Seemingly simple, but I cannot find anything relevant on the web. What is 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.