Actually you shouldn't use Gson for multiple reasons. It's in maintenance mode, it's not adapted to Kotlin features (it's a java library), and it's reflection-based. If you want to use a library that works like Gson, you should instead use its successor Moshi.
But the idiomatic Kotlin library is kotlinx.serialization. You should use this in most cases:
https://github.com/Kotlin/kotlinx.serialization
👍 2
👍🏽 1
c
calidion
01/12/2025, 11:38 AM
Thanks. I will update that part.
p
Pim
01/12/2025, 1:04 PM
@Joffrey I have always wondered. Is there a specific reason that
kotlinx.serialization
does not support xml?
j
Joffrey
01/12/2025, 1:22 PM
It does. It decouples the formats from the serialization déclaration. There are a few formats that are built-in, and indeed XML isn't built-in, but there is a third-party XML format for it which works great.