Ответ 1
Для десериализации JSONArray вам нужно использовать TypeToken. Подробнее об этом можно узнать из руководство пользователя GSON. Пример кода:
@Test
public void JSON() {
Gson gson = new Gson();
Type listType = new TypeToken<List<MyObject>>(){}.getType();
// In this test code i just shove the JSON here as string.
List<Asd> asd = gson.fromJson("[{'name':\"test1\"}, {'name':\"test2\"}]", listType);
}
Если у вас есть JSONArray, вы можете использовать
...
JSONArray jsonArray = ...
gson.fromJson(jsonArray.toString(), listType);
...