Согласно спецификации: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
A 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.
So вы не можете передавать коды 0x0A
или 0x0C
напрямую. Запрещено! Spec предлагает использовать escape-последовательности для некоторых четко определенных кодов от U+0000
до U+001F
:
\f represents the form feed character (U+000C).
\n represents the line feed character (U+000A).
Поскольку большинство языков программирования использует \
для цитирования, вам следует избегать синтаксиса escape (double-escape - один раз для языка / платформы, один раз для самого Json):
jsonStr = "{ \"name\": \"Multi\\nline.\" }";