Last active
June 8, 2018 23:02
-
-
Save teaddict/10929366d3a39268d34d2ce50d092aba to your computer and use it in GitHub Desktop.
CustomJacksonModule for Finatra with CamelCase strategy, default finatra jackson module uses SNAKE_CASE as namin strategy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.fasterxml.jackson.annotation.JsonInclude.Include | |
import com.fasterxml.jackson.core.JsonGenerator.Feature | |
import com.fasterxml.jackson.databind.ObjectMapper | |
import com.twitter.finatra.json.modules.FinatraJacksonModule | |
import com.twitter.finatra.json.utils.CamelCasePropertyNamingStrategy | |
object CustomJacksonModule extends FinatraJacksonModule { | |
override val serializationInclusion = Include.ALWAYS | |
override val propertyNamingStrategy = CamelCasePropertyNamingStrategy | |
override def additionalMapperConfiguration(mapper: ObjectMapper) { | |
mapper.configure(Feature.WRITE_NUMBERS_AS_STRINGS, true) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In your FinatraServer class you need to override:
override def jacksonModule = CustomJacksonModule