I'm using Retrofit with POJO to send a signup screen, which usually works, but the answer has two different objects depending on whether the result is valid. Which are:
{
"errors": {
"nome": [
"Campo obrigatório"
],
"sobrenome": [
"Campo obrigatório"
]
}
}
and:
{
"success": {
"nome": [
"Campo obrigatório"
],
"sobrenome": [
"Campo obrigatório"
]
}
}
And my POJO:
public class PostCadastro {
@SerializedName("nome")
@Expose
private String nome;
@SerializedName("sobrenome")
@Expose
private String sobrenome;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getSobrenome() {
return sobrenome;
}
public void setSobrenome(String sobrenome) {
this.sobrenome = sobrenome;
}
How can I deal with these two responses?