“Expected BEGIN_OBJECT but was STRING at line 1 column 1”

前端 未结 14 2210
误落风尘
误落风尘 2020-11-22 01:11

I have this method:

public static Object parseStringToObject(String json) {
    String Object = json;
    Gson gson = new Gson();
    Object objects = gson.f         


        
14条回答
  •  你的背包
    2020-11-22 01:46

    In my case, my custom http-client didn't support the gzip encoding. I was sending the "Accept-Encoding: gzip" header, and so the response was sent back as a gzip string and couldn't be decoded.

    The solution was to not send that header.

提交回复
热议问题