2
2
3
3
import com .fasterxml .jackson .annotation .JsonAutoDetect ;
4
4
import com .fasterxml .jackson .annotation .JsonInclude ;
5
+ import com .fasterxml .jackson .core .PrettyPrinter ;
5
6
import com .fasterxml .jackson .core .util .DefaultIndenter ;
6
7
import com .fasterxml .jackson .core .util .DefaultPrettyPrinter ;
8
+ import com .fasterxml .jackson .core .util .DefaultPrettyPrinter .Indenter ;
7
9
import com .fasterxml .jackson .core .util .Separators ;
8
10
import com .fasterxml .jackson .databind .ObjectMapper ;
9
11
import com .fasterxml .jackson .databind .SerializationFeature ;
@@ -99,7 +101,7 @@ static Function<Object, String> defaultJsonFunction() {
99
101
100
102
ObjectMapper objectMapper = buildObjectMapper ();
101
103
102
- DefaultPrettyPrinter pp = buildDefaultPrettyPrinter ();
104
+ PrettyPrinter pp = buildDefaultPrettyPrinter ();
103
105
104
106
return (object ) -> {
105
107
try {
@@ -110,7 +112,7 @@ static Function<Object, String> defaultJsonFunction() {
110
112
};
111
113
}
112
114
113
- private static DefaultPrettyPrinter buildDefaultPrettyPrinter () {
115
+ private static PrettyPrinter buildDefaultPrettyPrinter () {
114
116
DefaultPrettyPrinter pp = new DefaultPrettyPrinter ("" ){
115
117
@ Override
116
118
public DefaultPrettyPrinter withSeparators (Separators separators ) {
@@ -119,7 +121,9 @@ public DefaultPrettyPrinter withSeparators(Separators separators) {
119
121
return this ;
120
122
}
121
123
};
122
- pp .indentArraysWith (DefaultIndenter .SYSTEM_LINEFEED_INSTANCE );
124
+ Indenter lfOnlyIndenter = new DefaultIndenter (" " , "\n " );
125
+ pp .indentArraysWith (lfOnlyIndenter );
126
+ pp .indentObjectsWith (lfOnlyIndenter );
123
127
return pp ;
124
128
}
125
129
0 commit comments