I implement an API server with Finatra and my api outputs snake case json, i.e.;
case class A {
val someProperty: String
}
val a = A("value")
a
will be serialized int the json and vice versa
{"some_property":"value"}
But I have to access 3rd party API with camelcase json I/O, which represent above object with
{"someProperty":"value"}
I get object MyClientModule extends HttpClientModule
via guice injector.
How can I override/change jackson configuration to a specific httpclient?
HttpClientModule
implicitly useFinatraObjectMapper
. Though you can configureFinatraObjectMapper
to serialize/deserialize JSON with camelCase, it affects the behavior globally. One simple way is to explicitly explicitly instantiateHttpClient
with your camelCase object mapper. The another way is to define custom http client and its provider module.