22
33import com .fasterxml .jackson .annotation .JsonAutoDetect ;
44import com .fasterxml .jackson .annotation .JsonInclude ;
5+ import com .fasterxml .jackson .core .PrettyPrinter ;
56import com .fasterxml .jackson .core .util .DefaultIndenter ;
67import com .fasterxml .jackson .core .util .DefaultPrettyPrinter ;
8+ import com .fasterxml .jackson .core .util .DefaultPrettyPrinter .Indenter ;
79import com .fasterxml .jackson .core .util .Separators ;
810import com .fasterxml .jackson .databind .ObjectMapper ;
911import com .fasterxml .jackson .databind .SerializationFeature ;
@@ -97,7 +99,7 @@ static Function<Object, String> defaultJsonFunction() {
9799
98100 ObjectMapper objectMapper = buildObjectMapper ();
99101
100- DefaultPrettyPrinter pp = buildDefaultPrettyPrinter ();
102+ PrettyPrinter pp = buildDefaultPrettyPrinter ();
101103
102104 return (object ) -> {
103105 try {
@@ -108,7 +110,7 @@ static Function<Object, String> defaultJsonFunction() {
108110 };
109111 }
110112
111- private static DefaultPrettyPrinter buildDefaultPrettyPrinter () {
113+ private static PrettyPrinter buildDefaultPrettyPrinter () {
112114 DefaultPrettyPrinter pp = new DefaultPrettyPrinter ("" ){
113115 @ Override
114116 public DefaultPrettyPrinter withSeparators (Separators separators ) {
@@ -117,7 +119,9 @@ public DefaultPrettyPrinter withSeparators(Separators separators) {
117119 return this ;
118120 }
119121 };
120- pp .indentArraysWith (DefaultIndenter .SYSTEM_LINEFEED_INSTANCE );
122+ Indenter lfOnlyIndenter = new DefaultIndenter (" " , "\n " );
123+ pp .indentArraysWith (lfOnlyIndenter );
124+ pp .indentObjectsWith (lfOnlyIndenter );
121125 return pp ;
122126 }
123127
0 commit comments