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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:29:05+00:00 2026-05-31T03:29:05+00:00

I am attempting to parse the following JSON response with GSON: { total: 15,

  • 0

I am attempting to parse the following JSON response with GSON:

{
  "total": 15,
  "page": 2,
  "pagesize": 10,
  "rep_changes": [
    {
      "user_id": 2341,
      "post_id": 2952530,
      "post_type": "question",
      "title": "unprotected access to member in property get",
      "positive_rep": 5,
      "negative_rep": 0,
      "on_date": 1275419872
    },
   {
      "user_id": 2341,
      "post_id": 562948,
      "post_type": "question",
      "title": "Do you have any recommendations on Blend/XAML books/tutorials for designers?",
      "positive_rep": 20,
      "negative_rep": 0,
      "on_date": 1270760339
    }
  ....
}

These are the two classes I have defined (each class contains the respective getters and setters):

public class Reputation {
    private int total;
    private int page;
    private int pagesize;
    private List<RepChanges> rep_changes;

public class RepChanges {
    private int user_id;
    private int post_id;
    private String post_type;
    private String title;
    private int positive_rep;
    private int negative_rep;
    private long on_date;

I have been unable to parse the RepChanges class into the rep_changes attribute in the Reputation class. Any thoughts?

Note: I have managed to parse total, page, and pagesize (these are non-complex attributes). This is what I have done:

To parse the total, page, and pagesize, I used (and worked fine):

Gson gson = new Gson();
Reputation rep = gson.fromJson(jsonText, Reputation.class);

//doing this works:
int page = rep.getPage();
System.out.println(page);

However, when doing:

List<RepChanges> rep_changes = rep.getRep_changes();
for(RepChanges r : rep_changes){
    System.out.println(r.toString());
}

I (technically) do not get an error, but the following (which seems like a memory location):

stackoverflow.objects.RepChanges@116bb691
  • 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-31T03:29:07+00:00Added an answer on May 31, 2026 at 3:29 am

    In your Repchanges class, configure your own toString() method similar to this:

    public String toString ()
    {
        return "RepChanges [user_id=" + user_id + 
                ", post_id=" + post_id + 
                ", post_type=" + post_type + 
                ", title=" + title + 
                ", positive_rep=" + positive_rep + 
                ", negative_rep=" + negative_rep + 
                ", on_date=" + on_date + "]";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to parse a string like the following using a .NET regular
I am attempting to scrape a web page that has the following structures within
I'm attempting to parse XML in the following format (from the European Central Bank
I am attempting to parse keydown events from the numberpad with the following: $('#myDiv').keydown(function(e)
I'm attempting to write a bash script to parse out the following log file
I am attempting to parse the following date strings obtained from email headers: from
Can't seem to figure this out. I'm attempting JSON tree manipulation in GSON, but
I am attempting to parse the following String into a DateTime object in c#:
I am attempting to connect to a web page and return a JSON string.
I am attempting to parse a document that has the following (much simplified) structure.

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.