I have already read many answers about the same error, but nothing helps me.
Here I try to parse Json into my data class and get an error:
ErrorResponse bodyResponse = App.getGson().fromJson(responseString, ErrorResponse.class);
The error is : BEGIN_OBJECT but was STRING
This is my response string:
'{"title":"AccessCheckException","details":{"message":"User doesn't have authorized access."}}'
And Data class:
public class ErrorResponse {
public String title;
public Details details;
public ErrorResponse() {
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Details getDetails() {
return details;
}
public void setDetails(Details details) {
this.details = details;
}}
What is wrong?
My Details class code (I reduced get/set to post it)
public class Details {
public String code;
public String msg;
public Attachment attachment;
public String message;
public String description;
public Details() {
}
}
Thanks in advance.