I am using the Retrofit library to do REST calls to a service I am using.
If I make an API call to my service and have a failure, the service returns a bit of JSON
I compile many answer and wrote some code to achieve something nicer :
{
"errors": {
"email": [
"Email not valid.",
"Unable to find the user toto@toto.fr."
]
}
}
I take all item in 'email' and display them concatained with Guava Joiner:
String json = new String(((TypedByteArray)error.getResponse()
.getBody()).getBytes());
Map map = new Gson().fromJson(
json, new TypeToken