Hi everyone, I've been running into an issue when ...
# kotson
c
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
Kotson is deprecated and no longer maintained.
c
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
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
Fair enough; Thanks for taking the time to respond!
👍 1