You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
can you show me the code where you're trying to retrieve the list?
also what is the specific problem you're encountering when you try to retrieve the list?
Hi, I have problem invoking getListObject(). It says: Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $..
The code with problem is: Object value = gson.fromJson(jObjString,mClass);
I have a customized class called Property. gson.fromJson() does have a kind that with 1st parameter being string. I 'm so confused with this error.
Also, could you check my code with my own class? i'm not sure if it's right since ArrayList<Object> caused error as returned value for my customized class.
public ArrayList<Property> getListObject(String key, Class<?> mClass){
Gson gson = new Gson();
ArrayList<String> objStrings = getListString(key);
ArrayList<Property> objects = new ArrayList<>();
for(String jObjString : objStrings){
Object value = gson.fromJson({jObjString},mClass);
objects.add((Property) value);
}
return objects;
I have been trying to retrieve ListObjects but all to no avail. The issue here is the mClass. How do I go about it? Thanks. Nice work anyways
The text was updated successfully, but these errors were encountered: