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

  • Home
  • SEARCH
  • 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 6353773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:28:10+00:00 2026-05-24T22:28:10+00:00

I’m trying to parse a JSON feed using Gson in Android. I know the

  • 0

I’m trying to parse a JSON feed using Gson in Android. I know the JSON is valid. I suspect that it is because the format is like this:

 "Info":[
 {

"Id":"",
"Name":"",
"Description":"",
"Date":""
 }

In order to parse this I need to “dot” in. Ex: Info.Name

How can I do this in a serialized DTO?

@SerializedName("Name")
public String name;

@SerializedName("Description")
public String desc;

@SerializedName("Date")
public String date;

I tried to put “Info.” in front of each serializedName but that didn’t work either. I also know my JSON parsing method works properly, because it’s used somewhere else with a different DTO. But in that parsing, I don’t have to “dotting” issue.

Can anyone help?

EDIT: I have tried everything you guys posted, and nothing works. The error says:

The JsonDeserializer failed to deserialize json object {"Info":[{".......

SECOND EDIT:
I was able to get rid of the error, but now it returns null. Haha, getting pretty damn frustrated right about now!

  • 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-24T22:28:11+00:00Added an answer on May 24, 2026 at 10:28 pm

    I am assuming that the actual JSON you are intaking is valid because the example you provided is not. In your JSON example, you have "Info":[ but there is no outer object containing the “Info” property, which is a must. The valid JSON would be:

    {
     "Info": [
               {
                 "Id":"",
                 "Name":"",
                 "Description":"",
                 "Date":"",
               }
             ]
    }
    

    This is a JSON object that has a property “Info” which has a value that is a list of objects. This list of objects contains one object that has the properties “Id”, “Name”, “Description”, and “Date”, all of which have empty-string values.

    Here is a quick tutorial on how to use GSON to parse a JSON feed such as the above JSON:

    You will need a class to represent the items in the list:

    public class InfoItem {
         public String Id;
         public String Name;
         public String Description;
         public String Date;
         public InfoItem() {}
    }
    

    And one to represent the list of Items:

    public class InfoItemList extends LinkedList<InfoItem> {
        public InfoItemList() { super() };
    }
    

    This added complexity is because GSON cannot otherwise get the type of a generic collection from the class data.

    And one to represent the overall JSON message:

    public class InfoMessage {
        public InfoItemList Info;
        public InfoMessage() {};
    }
    

    And then just:

    gson.fromJson(jsonString, InfoMessage.getClass());
    

    If just de-serializing a collection:

    Type listType = new TypeToken<List<InfoItem>>() {}.getType();
    gson.fromJson(jsonString2, listType);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

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.