Hi, how do I deserialize type json objects?
{"photo":{"id":5, "url":"http://pics.com/pic1.jpg"}};
Because usually I would create a class:
public class Photo{ private int id; private String url; public Photo(){ } }
And then run it using:
GsonBuilder gsonb = new GsonBuilder(); Gson gson = gsonb.create(); Photo photo = gson.fromJson(response, Photo.class);
But it just fills everything with zeros. It would work if I were Json only
{"id":5, "url":"http://pics.com/pic1.jpg"}
Any ideas?
thanks
source share