Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json GSON正在尝试将字符串反序列化为double_Json_String_Double_Gson_Retrofit - Fatal编程技术网

Json GSON正在尝试将字符串反序列化为double

Json GSON正在尝试将字符串反序列化为double,json,string,double,gson,retrofit,Json,String,Double,Gson,Retrofit,我正在使用GSON转换器进行改装,以从RESTful Web服务获取JSON,当GSON尝试将JSON对象转换为POJO时,我得到了错误: Converter:conversionException:com.google.gson.JsonSyntaxException:java.lang.NumberFormatException:无效双精度:“610/182” 此元素对应于我的Java对象中的字符串变量: @Expose @SerializedName("code") private Str

我正在使用GSON转换器进行改装,以从RESTful Web服务获取JSON,当GSON尝试将JSON对象转换为POJO时,我得到了错误:

Converter:conversionException:com.google.gson.JsonSyntaxException:java.lang.NumberFormatException:无效双精度:“610/182”

此元素对应于我的Java对象中的字符串变量:

@Expose
@SerializedName("code")
private String code;
...
JSON对象是:

{“code”:“610/182”,…}

我在我的
重新适应程序中添加了一个转换器,如下所示:

    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);

为什么GSON试图将字符串转换为双精度?

您能否发布转换的完整代码。其他问题在其他地方有语法错误,导致这种情况。比如说完成课程后。确保没有其他`@SerializedName(“代码”)`已修复此问题此错误的原因是什么?