I am trying to parse this JSON:
{
"Aatrox": {
"version": "5.2.1",
"id": "Aatrox",
"key": "266",
"name": "Aatrox",
"title": "the Darkin Blade"
},
"Ahri": {
"version": "5.2.1",
"id": "Ahri",
"key": "103",
"name": "Ahri",
"title": "the Nine-Tailed Fox"
},
"Akali": {
"version": "5.2.1",
"id": "Akali",
"key": "84",
"name": "Akali",
"title": "the Fist of Shadow"
},
....
}
As you can see the elements all have the same attributes, so I want to parse them as a list of elements, here's the class I'm using:
public class CampeonBO {
private String version;
private String id;
private String key;
private String name;
private String title;
//Getters and Setters
}
And this is how I'm trying to parse it with Gson
Type type = new TypeToken<List<CampeonBO>>(){}.getType();
List<CampeonBO> campeones = gson.fromJson(bufferedReader, type);
And I'm getting the error:
Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $
Which is obviously because I don´t have an array in my JSON, I have 3 attributes "Aatrox, Ahri, Akali", but they all have the same attributes, so how can I parse them as a list using Gson?