In your case, I think, the JSON should be parsed into a List<Map<String,String>>. This can be done using Jackson. Following is a method that converts a JSON string into List<Map<String,String>>:
public static List<Map<String, String>> toList(String json) throws IOException {
List<Map<String, String>> listObj;
ObjectMapper MAPPER = new ObjectMapper();
listObj = MAPPER.readValue(json, new TypeReference<ArrayList<HashMap<String, String>>>() {
});
return listObj;
}
If you have created a POJO class for it then you can use:
public static List<PojoClass> toList(String json) throws IOException {
List<PojoClass> listObj;
ObjectMapper MAPPER = new ObjectMapper();
listObj = MAPPER.readValue(json, new TypeReference<ArrayList<PojoClass>>() {
});
return listObj;
}
Maven dependency for Jackson:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>