android - Nullpointer Exception while parsing json inner arraylist -


i using robospice springandroid parse json data. though managed json objects couldn’t retrieve inner arraylist of json objects within main json object.

this structure of result json parsed:

{   -model[n]:   -0:      {       name:"abcd"       innerlist[3]:        {          -0:             {              innerobject:               {                id:"10"                ....                }               .....             }               }      } }  

i getting null pointer exception when i'm accessing data members in pojo of innerobject.

@jsonignoreproperties(ignoreunknown = true) public class model{   @jsonproperty("name")  private string name;   @jsonproperty("innerlist")  private arraylist<classinnerlist> inner;   //getters , setters  }   

the pojo innerlist:

 @jsonignoreproperties(ignoreunknown = true)   public class classinnerlist   {     @jsonproperty("innerobject")    classinnerobject innerobject;     //getters , setters    }  

the pojo innerobject

@jsonignoreproperties(ignoreunknown = true)   public class classinnerobject{    @jsonproperty("id")   string id;  //getters , setters    } 

the request class follows

 public class getdetailsrequest extends springandroidspicerequest<model>   {     private string url;        private model model;        public getdetailsrequest() {       super(model.class);        this.url="my url"       ...........    }  @override   public model loaddatafromnetwork() throws exception {     resttemplate resttemplate=new resttemplate();     resttemplate.getmessageconverters().add(new mappingjackson2httpmessageconverter());     httpheaders httpheaders=new httpheaders();     httpheaders.set("key","keyvalue");     httpheaders.setaccept(collections.singletonlist(new   mediatype("application","json)));     httpentity<?> requestentity = new httpentity<object>(httpheaders);     responseentity<model> responseentity=resttemplate.exchange(url, httpmethod.get,requestentity,model.class);     model=responseentity.getbody();       return model; } } 


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -