android - Retrofit + GSON parse an Array of objects -
android - Retrofit + GSON parse an Array of objects -
i receive jason response ws:
[ [ "test0", "test0" ], [ "test1", "test1" ], [ "test2", "test2" ], [ "test3", "test3" ], [ "test4", "test4" ], [ "test5", "test5" ] ] notice there no name-value fields json array of strings arrays. tried several attemps parse response. tried pojo list of strings have same error always:
retrofit.retrofiterror: com.google.gson.jsonsyntaxexception: java.lang.illegalstateexception: expected begin_object begin_array @ line 1 column 2 path $
mypojo retrofit callback next one:
public class votepollresults {
private list<partialresult> fields; public list<partialresult> getfields() { homecoming fields; } public void setfields(list<partialresult> fields) { this.fields = fields; } public class partialresult { private string description; private integer votes; public partialresult(string description, integer votes) { this.description = description; this.votes = votes; } public string getdescription() { homecoming description; } public integer getvotes() { homecoming votes; } } }
i have list custom object, 1 handle json structure.
well resolved issue.
i have utilize callback on retrofit
callback<list<list<string>>> hope helps someone...
android parsing gson retrofit pojo
Comments
Post a Comment