diff --git a/base/src/main/java/com/fasterxml/jackson/jakarta/rs/base/ProviderBase.java b/base/src/main/java/com/fasterxml/jackson/jakarta/rs/base/ProviderBase.java index 05415d0..f4a0da3 100644 --- a/base/src/main/java/com/fasterxml/jackson/jakarta/rs/base/ProviderBase.java +++ b/base/src/main/java/com/fasterxml/jackson/jakarta/rs/base/ProviderBase.java @@ -565,7 +565,12 @@ public void writeTo(Object value, Class type, Type genericType, Annotation[] try { // Want indentation? if (writer.isEnabled(SerializationFeature.INDENT_OUTPUT)) { - g.useDefaultPrettyPrinter(); + PrettyPrinter defaultPrettyPrinter = writer.getConfig().getDefaultPrettyPrinter(); + if (defaultPrettyPrinter != null) { + g.setPrettyPrinter(defaultPrettyPrinter); + } else { + g.useDefaultPrettyPrinter(); + } } JavaType rootType = null; diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 036318e..672ab4a 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -15,6 +15,8 @@ Sub-modules: #36: Narrow types to format specific (e.g. CBORMapper) when resolving via JAX-RS Providers (suggested by Kevin W) +#41: Configure `PrettyPrinter` not correctly propagated to underlying + `JsonGenerator` * Woodstox dependency now 7.1.0 2.18.2 (27-Nov-2024)