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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:58:31+00:00 2026-05-25T01:58:31+00:00

I need help with deserializing JSON with gson. I have this JSON: { result:{

  • 0

I need help with deserializing JSON with gson.

I have this JSON:

    {
           "result":{
              "grid":{
                 "javaClass":"com.company.collections.GridSummary",
                 "page":{
                    "list":[
                       {
                          "javaClass":"com.company.services.issue.IssueSummary",
                          "sprintName":"",
                          "assignedTo":"dannyd",
                          "numChildren":-2147483648,
                          "startDate":{
                             "javaClass":"java.util.Date",
                             "time":1.302881465e12
                          },
                          "title":"QA work done on 1895747 - DD",
                          "hasClickPath":false,
                          "sprintId":"",
                          "productName":"",
                          "ownerId":"1895747",
                          "customFollowUp":"888-888-5555",
                          "assigneeFirstName":"Danny",
                          "lastActivityDate":{
                             "javaClass":"java.util.Date",
                             "time":1.302888278e12
                          },
                          "id":"1895885",
                          "global":false,
                          "timeSpent":0,
                          "assignee":{
                             "javaClass":"com.company.services.contact.ContactSummary",
                             "isSem":false,
                             "subType":0,
                             "doNotCampaign":false,
                             "status":0,
                             "rating":0,
                             "firstName":"Danny",
                             "salesProcess":{
                                "editable":false,
                                "javaClass":"com.company.modules.salesrules.SalesProcessSummary",
                                "rules":{
                                   "list":[

                                   ],
                                   "javaClass":"java.util.ArrayList"
                                }
                             },
                             "lastName":"D",
                             "doNotEmail":false,
                             "doNotCall":false,
                             "stage":0,
                             "isRemoved":false
                          },
                          "priority":3,
                          "jiraIdRemoved":false,
                          "read":false,
                          "productPlatform":"",
                          "filesAttached":-2147483648,
                          "parentId":"305599",
                          "type":72,
                          "productId":"",
                          "createdBy":"dannyd",
                          "status":2,
                          "productAppGroup":"",
                          "reporterId":"c8035a744046382000f0474c07d7ed34",
                          "jiraId":"",
                          "projectId":"",
                          "removed":false,
                          "assigneeLastName":"D",
                          "description":"",
                          "clientId":"CLIENTID",
                          "jiraSprintName":"",
                          "projectName":"",
                          "customFollowUpType":"Other"
                       }
                    ],
                    "javaClass":"java.util.ArrayList"
                 },
                 "totalCount":1183
              },
              "javaClass":"com.company.blocks.issues.commands.SearchIssues",
              "accountPlatform":"7.0"
           }
        }

and this code:

    import com.google.gson.Gson;
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.util.ArrayList;


    /**
     *
     * @author Danny
     */
    public class Deserialize {

        public void main() throws FileNotFoundException {
            BufferedReader json = new BufferedReader(new FileReader("C:\\Users\\dannyd\\Desktop\\jsonResults.txt"));
            Gson gson = new Gson();
            MyContainer container = gson.fromJson(json, MyContainer.class);
        }
    }

    class MyContainer {

        private Result result = new Result();

        //getters & setters
    }

    class Result {

        private Grid grid = new Grid();
        private String javaClass;
        private String accountPlatform;

        //getters & setters
    }

    class Grid {

        private String javaClass;
        private Page page = new Page();
        private Integer totalCount;

        //getters & setters
    }

    class Page {

        private ArrayList<PageList> list;
        private String JavaClass;

        //getters & setters
    }

    class PageList {

        private String javaClass;
        private String sprintName;
        private String assignedTo;
        private Integer numChildren;
        private D_DateObject startDate = new D_DateObject();
        private String title;
        private Boolean hasClickPath;
        private String sprintId;
        private String productName;
        private String ownerId;
        private String customFollowUp;
        private String assigneeFirstName;
        private D_DateObject lastActivityDate = new D_DateObject();
        private String id;
        private Boolean global;
        private Integer timeSpent;
        private Assignee assignee = new Assignee();
        private Integer priority;
        private Boolean jiraIdRemoved;
        private Boolean read;
        private String productPlatform;
        private Integer filesAttached;
        private String parentId;
        private Integer type;
        private String productId;
        private String createdBy;
        private Integer status;
        private String productAppGroup;
        private String reporterId;
        private String jiraId;
        private String projectId;
        private Boolean removed;
        private String assigneeLastName;
        private String description;
        private String clientId;
        private String jiraSprintName;
        private String projectName;
        private String customFollowUpType;

        //getters & setters
    }

    class D_DateObject {

        private String javaClass;
        private Integer time;

        //getters & setters
    }

    class Assignee {

        private String javaClass;
        private Boolean isSem;
        private Integer subType;
        private Boolean doNotCampaign;
        private Integer status;
        private Integer rating;
        private String firstName;
        private SalesProcess salesProcess = new SalesProcess();
        private String lastName;
        private Boolean doNotEmail;
        private Boolean doNotCall;
        private Integer stage;
        private Boolean isRemoved;

        //getters & setters
    }

    class SalesProcess {

        private Boolean editable;
        private String javaClass;
        private Rules rules;

        //getters & setters
    }

    class Rules {

        private AList list = new AList();
        private String javaClass;
        //getters & setters
    }

    class AList {
    }

It doesn’t seem as though gson is setting any of the variables in any of the classes. Am I doing something wrong? The JSON is being retrieved from a different location and I do not have access to change it. Thanks in advance for any help.

  • 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-25T01:58:32+00:00Added an answer on May 25, 2026 at 1:58 am

    I tried your example code and noticed 2 errors.

    1. Your main method needs to be static and you could throw an exception or catch it
    2. the time value specified in D_DateObject needs to be of type float (or double) not Integer

    So

    public static void main(String[] args) throws FileNotFoundException {
        BufferedReader json = new BufferedReader(new FileReader("jsonResults.txt"));
        Gson gson = new Gson();
        MyContainer container = gson.fromJson(json, MyContainer.class);
    }
    

    and

    class D_DateObject {
    
     private String javaClass;
     private float time; // this needed to be changed
    
     //getters & setters
    }
    

    Then the object was parsed using your objects (using gson 1.7.1)

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

Sidebar

Related Questions

i need help with disk_total_space function.. i have this on my code <?php $sql=select
I need help refactoring this multi-loop thing. Here is what I have: Campaign has_many
Need help with technical-designing of a website. I have a main page with a
Need help have no idea the thought process in doing this kind of simplification.
Need help pretty soon on this..... I have a Gridview in which the columns
need help I have this enum which sets the PayClassNo to Direct and Indirect.
Need help writing a script downloads data from google insight using c# this is
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I need help with this route map routes.MapRoute(Blog_Archive, Blog/Archive/{year}/{month}/{day}, new { controller = Blog,
Need help... I have 3 classes, Manager which holds 2 pointers. One to class

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.