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

前端 未结 14 2240
误落风尘
误落风尘 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:50

    Maybe your JSON Object is right,but the response that you received is not your valid data.Just like when you connect the invalid WiFi,you may received a strange response < html>.....< /html> that GSON can not parse.

    you may need to do some try..catch.. for this strange response to avoid crash.

提交回复
热议问题