Tag Archives: Gson parsing exception

Gson Parsing exceptions: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

First, check whether your retrofit configuration is correct and resolve the exception

.addconverterfactory (gsonconverterfactory. Create()) is modified here to the gson’s

Retrofit retrofit = new Retrofit.Builder()
        .baseUrl(HTTP_URL)
        .client(getOkHttpClient())
        .addConverterFactory(GsonConverterFactory.create())
        //Replace the converter, the return value is directly String, easy to parse the same field of different types of json data yourself
        .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
        .build();

If this position is like this, report an error

Check whether your API path is correct, and see if there is a missing ‘/’ or something