Provides comprehensive Jackson JSON processing support for Dropwizard applications with pre-configured ObjectMapper instances and essential modules.
npx @tessl/cli install tessl/maven-io-dropwizard--dropwizard-jackson@4.0.0Dropwizard Jackson provides comprehensive Jackson JSON processing support for Dropwizard applications. It offers pre-configured ObjectMapper instances with sensible defaults and essential modules for handling Guava collections, Java 8 Optional and time types, parameter name preservation, enum fuzzy matching, and high-performance serialization.
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-jackson</artifactId>
<version>4.0.14</version>
</dependency>import io.dropwizard.jackson.Jackson;
import io.dropwizard.jackson.JsonSnakeCase;
import io.dropwizard.jackson.Discoverable;
import com.fasterxml.jackson.databind.ObjectMapper;import io.dropwizard.jackson.Jackson;
import com.fasterxml.jackson.databind.ObjectMapper;
// Create a fully configured ObjectMapper
ObjectMapper mapper = Jackson.newObjectMapper();
// Serialize an object to JSON
String json = mapper.writeValueAsString(myObject);
// Deserialize JSON to object
MyClass obj = mapper.readValue(json, MyClass.class);
// Create a minimal ObjectMapper (less aggressive configuration)
ObjectMapper minimalMapper = Jackson.newMinimalObjectMapper();The package is built around the central Jackson utility class which provides factory methods for creating pre-configured ObjectMapper instances. The configuration includes:
Creates pre-configured Jackson ObjectMapper instances optimized for Dropwizard applications.
public static ObjectMapper newObjectMapper()
public static ObjectMapper newObjectMapper(JsonFactory jsonFactory)
public static ObjectMapper newMinimalObjectMapper()Custom Jackson modules for enhanced serialization capabilities including Caffeine cache specs and fuzzy enum handling.
public class CaffeineModule extends Module
public class FuzzyEnumModule extends Module
public class GuavaExtrasModule extends ModuleAnnotation-driven property naming that switches between camelCase and snake_case based on class annotations.
public class AnnotationSensitivePropertyNamingStrategy extends PropertyNamingStrategy
public @interface JsonSnakeCaseService-based discovery mechanism for polymorphic configurations using META-INF/services.
public class DiscoverableSubtypeResolver extends StdSubtypeResolver
public interface Discoverable