胡子哥哥
根据规范:http:/www.ecma-international.org/public/files/ecma-ST/ecma-404.pdfA string is a sequence of Unicode code points wrapped with quotation marks(U+0022). All characters may be placed within the quotation marks except for the
characters that must be escaped: quotation mark (U+0022), reverse solidus(U+005C), and the control characters U+0000 to U+001F. There are two-character
escape sequence representations of some characters.所以你不能通过0x0A或0x0C直接编码。这是禁止的!规范建议对一些定义良好的代码使用转义序列。U+0000到U+001F:\f represents the form feed character (U+000C). \n represents the line feed character (U+000A).正如大多数编程语言所使用的那样\对于引用,您应该转义语法(双转义-一次用于语言/平台,一次用于JSON本身):jsonStr = "{ \"name\": \"Multi\\nline.\" }";