Gson and deserializing an array of objects with arrays in it
问题 I am trying to use Gson to deserialize a json string returned from my webservice The structure would be returned as TypeDTO[] . where TypeDTO is like int id; String name; ArrayList<ItemDTO> items[] and ItemDTO is like int id; String name; Boolean valid; When I call the code as follows Gson gson = new Gson(); TypeDTO[] mytypes = (TypeDTO[]) gson.fromJson(reply, TypeDTO[].class); Everything inside the objects is null However, If I use the JSONArray and JSONObject to pull them out piece by piece