Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON, Jackson and multiline string

I have the following JSON.

{ "content" : "value" }

I have Jackson constructing the JSON string.

If the value is a multiline text, example:

A
B
C

What I see is: { "content" : "A\r\nB\r\nC" }

It explicitly sets \r\n (CRLF) for every line.

I am wondering if I can configure Jackson to output this:

{ "content" : "A
B
C" }

Which is; A, B and C are rendered as 3 lines and not in 1 line as "A\r\nB\r\nC".

like image 683
serverfaces Avatar asked Nov 03 '22 10:11

serverfaces


1 Answers

If I understand you correctly, you wonder why Jackson escapes linefeeds. If so, the answer can be found right here.

like image 99
StaxMan Avatar answered Nov 09 '22 11:11

StaxMan