JSON 파싱 시에 GSON 을 사용하면 나타날 수 있는 오류
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
Retrofit 객체를 만들 때, Gson 객체를 만들어서 추가해주면 해결.
class RetrofitHelper {
companion object{
fun getRetrofitInstance(baseUrl: String) : Retrofit{
val gson: Gson = GsonBuilder()
.setLenient()
.create()
val retrofit = Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create(gson))
.build()
return retrofit
}
}
}