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