Sample Json -
{"error":
{"message":"irp-return-error",
"irp-err":{"ErrorCode":"1015","ErrorMessage":"Invalid Data for this user"}
}
}
I tried setting the name using @SerializedName Gson annotation
public class Error {
@SerializedName("irp-err")
private IrpErr irpErr;
private String message;
but the call to the json object returns null.
Gson erngson = new Gson();
ErrResponse data = erngson.fromJson(response.readEntity(String.class), ErrResponse.class);
if(data.getError()!=null){
IrpErr irperr = data.getError().getIrpErr(); //NPE
}