Notice
Recent Posts
Recent Comments
Link
ยซ   2024/10   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
๊ด€๋ฆฌ ๋ฉ”๋‰ด

๐ŸŒฑ dreaming DiNO

[Kotlin] [์—๋Ÿฌํ•ด๊ฒฐ] com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 2 column 10 path $. ๋ณธ๋ฌธ

Android

[Kotlin] [์—๋Ÿฌํ•ด๊ฒฐ] com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 2 column 10 path $.

MK_____ 2023. 3. 9. 09:21
๋ฌธ์ œ ๋ฐœ์ƒ

com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 2 column 10 path $.

 

๋ฌธ์ œ ํ•ด๊ฒฐ

Retrofit ๊ฐ์ฒด ์ดˆ๊ธฐํ™” ํ•˜๋Š” ๊ณณ์—์„œ,

GsonConverterFactory.create() ์•ˆ์— GsonBuilder().setLenient().create() ๋ฅผ ๋„ฃ์–ด์ค€๋‹ค

 

์ˆ˜์ • ์ „

private val retrofit: Retrofit = Retrofit.Builder()
    .addCallAdapterFactory(ResponseAdapterFactory())
    .baseUrl(BASE_URL)
    .client(okHttpClient)
    .addConverterFactory(GsonConverterFactory.create())
    .build()

 

์ˆ˜์ • ํ›„

private val retrofit: Retrofit = Retrofit.Builder()
    .addCallAdapterFactory(ResponseAdapterFactory())
    .baseUrl(BASE_URL)
    .client(okHttpClient)
    .addConverterFactory(GsonConverterFactory.create(GsonBuilder().setLenient().create()))
    .build()