java - Retrofit GSON Parsing Arraylist Inside of Object -
i have json object this:
{ products:[ { name:prod1, quantity:3 }, { name:prod2, quantity:1 } ] }
i have gson object so:
public class product{ @serializedname("name") public string name; @serializedname("quantity") public int quantity; }
when set retrofit this
@get("/products") void getproducts(callback<arraylist<product>> c);
it fail, obviously, because array isn't root object. there simple way force dig down json 1 level before parsing arraylist, or going have create whole gson adapter accomplish this?
i accomplished creating , using own custom deserializer. code simpler full gson adapter, accomplishes need.
Comments
Post a Comment