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 ;
@@ -99,7 +101,7 @@ static Function<Object, String> defaultJsonFunction() {
99101
100102 ObjectMapper objectMapper = buildObjectMapper ();
101103
102- DefaultPrettyPrinter pp = buildDefaultPrettyPrinter ();
104+ PrettyPrinter pp = buildDefaultPrettyPrinter ();
103105
104106 return (object ) -> {
105107 try {
@@ -110,7 +112,7 @@ static Function<Object, String> defaultJsonFunction() {
110112 };
111113 }
112114
113- private static DefaultPrettyPrinter buildDefaultPrettyPrinter () {
115+ private static PrettyPrinter buildDefaultPrettyPrinter () {
114116 DefaultPrettyPrinter pp = new DefaultPrettyPrinter ("" ){
115117 @ Override
116118 public DefaultPrettyPrinter withSeparators (Separators separators ) {
@@ -119,7 +121,9 @@ public DefaultPrettyPrinter withSeparators(Separators separators) {
119121 return this ;
120122 }
121123 };
122- pp .indentArraysWith (DefaultIndenter .SYSTEM_LINEFEED_INSTANCE );
124+ Indenter lfOnlyIndenter = new DefaultIndenter (" " , "\n " );
125+ pp .indentArraysWith (lfOnlyIndenter );
126+ pp .indentObjectsWith (lfOnlyIndenter );
123127 return pp ;
124128 }
125129
0 commit comments