【问题标题】:Remove special chars from Retrofit2 response从 Retrofit2 响应中删除特殊字符
【发布时间】:2017-03-29 22:01:22
【问题描述】:

我正在尝试将 Retrofit2 与 GsonConverterFactory 一起使用,问题是这是我从 okhttp 得到的响应:

"{\r\n  \"Template\": {\r\n    \"id\": 11,\r\n    \"name\": \"Zoo London\"\r\n  },\r\n  \"Screens\":...

因此我得到以下异常:

java.lang.IllegalStateException:应为 BEGIN_OBJECT,但在第 1 行第 2 列为 STRING

如何使用 retrofit2 删除特殊字符和回车?

【问题讨论】:

标签: android json retrofit retrofit2


【解决方案1】:

问题已通过确保 api 返回有效的 JSON 得到解决

【讨论】:

    猜你喜欢
    • 2011-04-11
    • 2016-01-23
    • 2016-10-26
    • 2014-08-17
    • 1970-01-01
    相关资源
    最近更新 更多