How can I bypass `JsonNamingStrategy.SnakeCase` wh...
# serialization
a
How can I bypass
JsonNamingStrategy.SnakeCase
when I have a
@SerialName
annotation ? I really need this as I need to conform to a JSON where everything is snake_case except one field (maybe an error from the API but I have no choice)
s
Unfortunately you can't do it as-is, as serial names are also transformed. You can, however, implement your own
JsonNamingStrategy
and check
descriptor.serialName
and property
serialName
to determine whether it should be transformed (and delegate to
SnakeCase
later)
a
Nice thanks, I'll try this !
Working fine 😆