我总是从改造中获得错误(gson):
retrofit.RetrofitError:com.google.gson.stream.MalformedJsonException:
Use JsonReader.setLentient(true) to accept malformed JSON at line 1
column 15 path $
但在我看来,我的回归是正确的。它在我的本地服务器上工作,但是当我上传到webspace时,我总是得到这个:/在下面的例子中,我发送了一个JSONObject形式为{" string":" test"}和webservice只是返回它(答案实际上到达设备,但改装抛出上面的错误)。相关的Logs from Retrofit:
---> HTTP POST http://mywebserver.net/set_string.php
Content-Type: application/json
Content-Length: 19
{"string":"test"}
---> END HTTP (19-byte body)
<--- HTTP 200 http://mywebserver.net/set_string.php (351ms)
HTTP/1.1 200 OK
Connection: close
Content-Length: 188
Content-Type: application/json
Date: Tue, 26 May 2015 12:11:40 GMT
Server: Apache
X-Android-Received-Millis: 1432642297627
X-Android-Response-Source: NETWORK 200
X-Android-Sent-Millis: 1432642297438
X-Powered-By: PHP/5.2.17
{"string":"test"}
<!-- Hosting24 Analytics Code -->
<script type="text/javascript"
src="http://stats.hosting24.com/count.php"></script>
<!-- End Of Analytics Code -->
<--- END HTTP (188-byte body)
提前感谢您的帮助!