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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:55:51+00:00 2026-05-31T22:55:51+00:00

I already looked at a similar question here : null pointer exception-parsing json with

  • 0

I already looked at a similar question here : null pointer exception-parsing json with gson android

I’m getting same error but my objects are slightly different and it fails only on android 2.2 but not android 2.3. Somme googling seems to looks like it’s a known 2.2 bug fixed in 2.3. But maybe there is a workaround ?

So here is the code :

NewsContainer newsContainer = gson.fromJson(response, NewsContainer.class);

the json answer :

{"newsList":
{"group":
    {"news":
        {"news":
            {"ranking":"1","id":"NEWS-33713","type":"Fnac","title":"LAURENT GERARD, GERARD COMME ...","subtitle":"THEATRE DES MATHURINS","preview":"http:\/\/www.fnacspectacles.com\/static\/0\/visuel\/grand\/215\/LAURENT-GERARD_2159024664536169906.jpg?1325241781000","details":"LAURENT GERARD, GERARD COMME ...\nDu: 24\/01\/2012 au 30\/06\/2012","address":"36, rue des Mathurins 75008 PARIS","url":"http:\/\/ad.zanox.com\/ppc\/?21135664C184852886&ULP=[[\/place-spectacle\/manifestation\/Seul-en-scene-LAURENT-GERARD--GERARD-COMME-----RARD.htm]]","start_date":"2012-01-24 00:00:00","poi":                  {"latitude":"48.8731960","longitude":"2.3257960"}
            }
        }
    }
}

}

And here is my objects :

public class NewsContainer {
private NewsList newsList;

public NewsContainer() {
    ;
}

private static class NewsList {
    List<NewsGroup> group;
}

public List<NewsGroup> getNewsList() {
    return newsList.group;
}

public void setNewsList(List<NewsGroup> newsList) {
    this.newsList.group = newsList;
}

}

public class NewsGroup implements Group{
private Long id;
private String title;
//    @Exclude
private List<News> news;

public List<News> getNews() {
    return news;
}

public NewsGroup() {
}

public void setNews(List<News> news) {
    this.news = news;
}

public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public String getTitle() {
    return title;
}

public void setTitle(String title) {
    this.title = title;
}

@Override
public List<? extends Item> getItems() {
    return news;
}

}

The is a lot more objects involved, but it would be too long to had it here. Ask if you need to see one of them.

Regards

  • 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-31T22:55:52+00:00Added an answer on May 31, 2026 at 10:55 pm

    In the Gson, we generally use List < T > when we’re dealing with JSON arrays. From your JSON answer, I see that there are no arrays (only objects within objects). If your newslist contains MANY groups, then JSON should be like:

    {"newsList":
        "group" : [{"news":  .... }, ... ]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pardon me if there's a similar question somewhere on here already, but I couldn't
I've asked a similar question to this before and I've looked at several similar
I've got a problem at programming for iOS. Already looked for some similar problems
I've already looked at similar questions but the answers provided involve buttons and not
I've looked everywhere for a similar error but couldn't find a solution, so in
i know, similar questions have been asked, and i've already looked through everything i
I've already looked around but couldn't find the exact solution/problem I'm having right now.
Error: 155004 (Attempted to lock an already-locked dir) Description: Working copy '/Users/Carrie/MyProjects/Sandbox/Flip/Classes' locked
I already know the obvious answer to this question: just download <insert favorite windows
This is not a duplicate post. I've looked through similar questions on SO but

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.