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.

https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/jsondeserializer.html


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -