Parse JSON to java Class -


i have json , i'm trying parse java classes using gson. here json

resp = "{"isvisible":true,"image":{"preferenceorder":["rose","lilly","lotus"]}}"; 

my parse code java this.

imageorderresult result = new gson().fromjson(resp,imageorderresult.class); 

and here class have defined

public class imageorderresult {     //used general error tracing     public string status = "";     public string message = "";     public string errortrace = "";      public class image{         @serializedname("preferenceorder")         public arraylist<string> flowers= new arraylist<string>();     }      @serializedname("isvisible")     public boolean isvisible= false;  }     

here i'm missing out flowers array part. parser not able fetch list of values. how solve it?

the problem have type of image defined, class missing reference variable "store" in. need define class serialized:

public class imageorderresult {     //used general error tracing     public string status = "";     public string message = "";     public string errortrace = "";      @serializedname("image")     public image image = null;      @serializedname("isvisible")     public boolean isvisible= false;        public class image{         @serializedname("preferenceorder")         public arraylist<string> flowers= new arraylist<string>();     } }     

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -