I'm using Retrofit with a GSON converter to obtain JSON from a RESTful Web Service and when GSON tries to convert a JSON object to POJO I'm getting the error:
retrofit.Converter:conversionException: com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Invalid double: "610/182"
This element corresponds to a String variable in my Java Object:
@Expose
@SerializedName("code")
private String code;
...
And the JSON Object is:
{"code":"610/182", ...}
I added a converter to my RestAdapter like this:
restAdapter = new RestAdapter.Builder()
.setEndpoint(URL_BASE)
.setClient(new OkClient(getClient()))
.setConverter(new GsonConverter(gson))
.setLogLevel(RestAdapter.LogLevel.FULL)
.build();
api = restAdapter.create(ApiRest.class);
Why GSON is trying to convert a String into a double?
Aucun commentaire:
Enregistrer un commentaire