Hello World, I have litteraly dozens of Enum class...
# serialization
j
Hello World, I have litteraly dozens of Enum classes like this where the default Enum serializer don't work only because the case is different, PascalCase in Kotlin versus snake_case when serialized. Is it possible to somehow wrap the default serializer to add a call to
.toPascalCase()
and
.to_snake_case()
instead of having all those
@SerialName
?
p
Copy Paste the default enums serializer and do the renaming there.
👍 1
If it's json you can also use a jsonTransformingSerializer
j
It. worked, thanks a lot Paul
🤞 1
e
write your own processor to generate whatever kinds of case mappings you like (example, test)
🙏 1
t
So disappointed that
UPPER_SNAKE_CASE
isn’t called
SCREAMING_SNAKE_CASE
instead, ephemient… 🙂