0
即时寻找控制何时将响应解析为json的可能性。 我打电话给一个端点,我实际上不能修改结果,我从那个笨笨的 PHP Script中得到一个丑陋的'ok'。问题是,JSON解析器试图解析这一点,失败:翻新响应解析
D/Retrofit(6334): <--- HTTP 200 https://somewhere.com/endpoint.php?idfv=android_id&UserInterfaceIdiom=hammerhead&systemVersion=1.0&status=Not+Set&batteryLevel=100%25&localizedModel=Nexus+5&systemName=Android+OS&bundleShortVersion=1&language=eng&batteryState=USB&bundeIdentifier=com.packagename&bundleVersion=1.0 (475ms)
D/Retrofit(6334): : HTTP/1.1 200 OK
D/Retrofit(6334): Connection: Keep-Alive
D/Retrofit(6334): Content-Type: text/html
D/Retrofit(6334): Date: Tue, 07 Oct 2014 14:49:20 GMT
D/Retrofit(6334): Keep-Alive: timeout=5, max=100
D/Retrofit(6334): OkHttp-Received-Millis: 1412693360928
D/Retrofit(6334): OkHttp-Response-Source: NETWORK 200
D/Retrofit(6334): OkHttp-Selected-Protocol: http/1.1
D/Retrofit(6334): OkHttp-Sent-Millis: 1412693360859
D/Retrofit(6334): Server: Apache
D/Retrofit(6334): Vary: Accept-Encoding
D/Retrofit(6334): X-Powered-By: PHP/5.4.4-14+deb7u14
D/Retrofit(6334): OK
D/Retrofit(6334): <--- END HTTP (2-byte body)
我RX认购获得calledthat解析时错误:
retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1
我不能空例如JSON解析器/转换器, null会导致NullPointerException被Retrofit抛出。
好的,谢谢:) – Kitesurfer 2014-10-07 16:27:49