Hi - is there a way to override the body lens seri...
# http4k
v
Hi - is there a way to override the body lens serialisation setting to not write empty lists as nulls?
Nulls.AS_EMPTY
d
you can define your own Jackson object using the template here:
Copy code
object Jackson : ConfigurableJackson(KotlinModule()
    .asConfigurable()
    .withStandardMappings()
    .done()
    .disableDefaultTyping()
    .configure(FAIL_ON_UNKNOWN_PROPERTIES, false)
    .configure(FAIL_ON_IGNORED_PROPERTIES, false)
    .configure(USE_BIG_DECIMAL_FOR_FLOATS, true)
    .configure(USE_BIG_INTEGER_FOR_INTS, true)
)
(the last lines there are the Jackson mapper config)
(assuming Jackson)
v
yes correct - thank you. so if I include this definition, is this automatically picked up by http4k?
d
no - when you define your own Jackson instance you will need to import everything from there instead of from our Jackson
Copy code
object MyJackson : ConfigurableJackson(KotlinModule()
    .asConfigurable()
    .withStandardMappings()
    .done()
    .disableDefaultTyping()
    .configure(FAIL_ON_UNKNOWN_PROPERTIES, false)
    .configure(FAIL_ON_IGNORED_PROPERTIES, false)
    .configure(USE_BIG_DECIMAL_FOR_FLOATS, true)
    .configure(USE_BIG_INTEGER_FOR_INTS, true)
)
then
import org.bob.MyJackson.auto
v
oh I see ok - thanks!