I am trying to get the value of class in the following JSON:
{
"battlegroup": "Misery",
"class": 1,
"race": 4,
"gender": 0
}
I access the other fields (battlegroup
, race
etc.) with:
WoWDetails info = gson.fromJson(response, WoWDetails.class);
raceID = info.race;
WoWDetails is as following:
class WoWDetails {
// character details
public String battlegroup;
public Integer achievementPoints;
public Integer race;
public Integer class;
}
But if I try WoWDetails.class
it's giving me an error saying "Unknown class: info". Which makes sense because info is not a class.
Is there a way around this? Can I escape the word "class" in any way possible?
The name class is not editable, since it's not my API.