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 ;
@@ -97,7 +99,7 @@ static Function<Object, String> defaultJsonFunction() {
97
99
98
100
ObjectMapper objectMapper = buildObjectMapper ();
99
101
100
- DefaultPrettyPrinter pp = buildDefaultPrettyPrinter ();
102
+ PrettyPrinter pp = buildDefaultPrettyPrinter ();
101
103
102
104
return (object ) -> {
103
105
try {
@@ -108,7 +110,7 @@ static Function<Object, String> defaultJsonFunction() {
108
110
};
109
111
}
110
112
111
- private static DefaultPrettyPrinter buildDefaultPrettyPrinter () {
113
+ private static PrettyPrinter buildDefaultPrettyPrinter () {
112
114
DefaultPrettyPrinter pp = new DefaultPrettyPrinter ("" ){
113
115
@ Override
114
116
public DefaultPrettyPrinter withSeparators (Separators separators ) {
@@ -117,7 +119,9 @@ public DefaultPrettyPrinter withSeparators(Separators separators) {
117
119
return this ;
118
120
}
119
121
};
120
- pp .indentArraysWith (DefaultIndenter .SYSTEM_LINEFEED_INSTANCE );
122
+ Indenter lfOnlyIndenter = new DefaultIndenter (" " , "\n " );
123
+ pp .indentArraysWith (lfOnlyIndenter );
124
+ pp .indentObjectsWith (lfOnlyIndenter );
121
125
return pp ;
122
126
}
123
127
0 commit comments