scala-json
scala-json copied to clipboard
Custom naming convention for fields (CamelCase, snake_case...)
Jackson allows to use custom naming strategies for fields. It implements a configurable PropertyNamingStrategy: https://fasterxml.github.io/jackson-databind/javadoc/2.7/com/fasterxml/jackson/databind/PropertyNamingStrategy.html
This has also been added to Play Json in the macros system: https://www.playframework.com/documentation/2.7.x/ScalaJsonAutomated#Custom-Naming-Strategies
Alternatively there is also an additional module for this purpose: https://github.com/tototoshi/play-json-naming
Do you think this feature could be supported by scala-json?
we have field naming via the 'json.name' annotation available in the standard annotation set: https://github.com/MediaMath/scala-json/blob/7b042c5a2dea07a838b84856d33ca1490c99e8e1/shared/src/test/scala/json/JSONTest.scala#L44
this should allow for simple field renaming in a marshallable object type.
Great. I missed this feature. While I would prefer something more unobstrusive it's a nice workaround for this issue. Thanks!
I would like to enforce a "camelCase" to "snake_case" conversion (for serialization/deserialization) at source level (from a local fork). Any advice regarding where I should operate the different changes? Thank you.