Example usage for com.fasterxml.jackson.databind PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy

List of usage examples for com.fasterxml.jackson.databind PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy.

Prototype

PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy

Source Link

Usage

From source file:org.openmhealth.dsu.configuration.JacksonConfiguration.java

@Bean
public ObjectMapper objectMapper() {

    ObjectMapper objectMapper = new ObjectMapper();

    // serialise timestamps in an ISO8601 textual representation
    objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);

    // serialise keys in snake_case
    objectMapper.setPropertyNamingStrategy(new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy());

    return objectMapper;
}