Is there a good analysis somewhere of json seriali...
# announcements
w
Is there a good analysis somewhere of json serialization options? jackson vs kotlinx (#C7A1U5PTM ) vs #C90AVCDQU ? I have been using jackson, but I am wondering if I should spend some time to switch to something else, if it is more lightweight, or involves less dependencies
g
What is "lightweight" in this case? Jackson is pretty big library, but also one of the fastest
w
I was just thinking in terms of what is the bare minimum I need to get the job done. and also which library works best with kotlin out-of-the box.
g
If you need object mapping you have not so many choices: Jackson, Gson, Moshi and Klaxon, I don’t know other. Klaxon written on Kotlin and for Kotlin and have support of nullability and some other Kotlin features.
But Jackson and Moshi also have special Kotlin adapters, Moshi even have code generation.
But even without special kotlin adapters it’s fine, you just should be careful with nullability and some features (like default values)
There are also a few minimalistic Json parsers for JVM that can be used without problems from Kotlin, no mapping, but if you just want read Json and get a few values it also fine. Everything is tradeoff between feature set, library size and performance
w
Thanks. I think ill stick with jackson for now
g
There is also Jackson Kotlin complimentary library that uses kotlin-reflect and supports some Kotlin features