I have an errorLogList json data which can be object or array. I want to Gson to handle both array and objects. I have found some TypeAdapters but I don't know how to use it with inner String List. Is there any solution?
Gson gson = new Gson();
LogData logData= gson.fromJson(jsonData, LogData.class);
JSON data examples;
"{"time":1473092580000,"logs":{"errorLog":{"errorLogList":"fatal error occured","id":"2323232"}}}"
"{"time":1473092580000,"logs":{"errorLog":{"errorLogList":["fatal error occured","warning occured"],"id":"2323232"}}}"
public class LogData{
private Log logs;
....
}
public class Log{
private ErrorLog errorLog;
....
}
public class ErrorLog{
private List<String> errorLogList;
}