Modeling results in java class

Modeling results in java class

Posted 2 Aug 2016, 7:42:31

I'm new, and having some issues when fitting my GET request results into my Java data model.
Particularly, I have modeled “set” as a class. But commonly, I get results back from my HTTP requests that have “set” as an empty string or even an array.

I'll use this following GET request for all Radiohead setlists as an example: http://api.setlist.fm/rest/0.1/artist/a74b1b7f-71a5-4011-9441-d0b5e4122711/setlists.json

Notice how, for the most part, “set” is an object. But in some instances, it is a String. In other instances it is an array.

My Android Studio is giving me the following error:
Expected BEGIN_OBJECT but was STRING at line 1 column 897 path $.setlists.setlist0.sets

Does anyone have advice on how to handle this type of thing? I've noticed it with all artists I've looked up so far.
Thanks!

Post Reply

You're not allowed to do this, please sign in first.