Reputation: 23
I am making a call to the Steam Storefront api and am trying to model the data in java but am having trouble wrapping my head around how to do so because of a slight issue.
So, say you make a call Appid 57690 = Tropico 4
http://store.steampowered.com/api/appdetails?appids=57690
It will return with the header {"57690": {... rest of json }}
But if you make the call to Appid 570 = Dota 2
http://store.steampowered.com/api/appdetails?appids=570
It will return with the header {"570": {... rest of json }}
How do you create the POJO's to model this, because it is a header?
Upvotes: 2
Views: 82
Reputation: 8031
Just create a class, inside add one property of type "String" and then an object for the rest of the JSON.
For example
public class MyClass{
public String rootId = "";
public SteamObj steamObj = new SteamObj();
}
public class SteamObj {
//Who knows what
}
Either way you can make use of this tool to generate the POJO for you:
http://www.jsonschema2pojo.org/
Upvotes: 1