https://kotlinlang.org logo
#kotson
Title
# kotson
c

Caleb Hulbert

08/18/2021, 5:27 PM
Hi everyone, I've been running into an issue when using pure
gson
with kotlin, when using delegates. When deserializing and object. the delegate and the field it refers to are deserialized by reflection, and so they end up referring to different objects (i.e. using the delegate to `setValue`/`getValue` no longer updates the field it should be updating). I was wondering if
Kotson
has a was around this? The only way I have had luck so far was creating a custom deserializer for every class which uses delegates, but that's not really ideal.
s

salomonbrys

08/19/2021, 10:10 AM
Kotson is deprecated and no longer maintained.
c

Caleb Hulbert

08/19/2021, 3:35 PM
I understand that, I was just wondering if this was an issue that was addressed. I'm not trying to use kotson directly, but rather pure GSON in kotlin. It's a longshot, but I figured I would ask if anyone ran into this during kotson development or while using kotson
s

salomonbrys

08/20/2021, 10:48 AM
Nope. Even if it were still maintained, this falls out of the score of the lib which was a thin Kotlin layer over GSon, and nothing magical or complex. I'd recommend moving to Moshi, or moving the property delegate functions out of the classes (as extension functions).
c

Caleb Hulbert

08/23/2021, 7:49 PM
Fair enough; Thanks for taking the time to respond!
👍 1
9 Views