報錯堆棧:
Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: (org.apache.cxf.transport.http.AbstractHTTPDestination$1); line: 3, column: 34
報錯原因:
字符串中包含換行 '\n'
解決辦法:
1.在'\n'之前加轉義符號'\';
2.ObjectMapper MAPPER = new ObjectMapper();給MAPPER設置一個屬性 MAPPER.configure(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);