結論
setLenient()
を有効にしたGsonオブジェクトをGsonConverterFactory.create()
に渡す。
環境
retrofit version: 2.3.0
エラー内容
com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 2 column 5 path $
サンプルコード
Gson gson = new GsonBuilder()
.setLenient()
.create();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();