JSON,Jackson和多行字符串 [英] JSON, Jackson and multiline string
本文介绍了JSON,Jackson和多行字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下JSON.
{ "content" : "value" }
我让Jackson构建了JSON字符串.
I have Jackson constructing the JSON string.
如果该值为多行文本,则示例:
If the value is a multiline text, example:
A
B
C
我看到的是:{ "content" : "A\r\nB\r\nC" }
它为每行显式设置\r\n
(CRLF).
It explicitly sets \r\n
(CRLF) for every line.
我想知道我是否可以配置Jackson输出:
I am wondering if I can configure Jackson to output this:
{ "content" : "A
B
C" }
是哪个; A,B和C呈现为3行,而不是呈现为"A \ r \ nB \ r \ nC"的1行.
Which is; A, B and C are rendered as 3 lines and not in 1 line as "A\r\nB\r\nC".
推荐答案
如果我对您的理解是正确的,您会怀疑杰克逊为什么不换行.如果是这样,可以在此处找到答案.
If I understand you correctly, you wonder why Jackson escapes linefeeds. If so, the answer can be found right here.
这篇关于JSON,Jackson和多行字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文