-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Description
The JSON emitter does not seem to be escaping control characters, like newlines. For example, with this code:
#include <stdio.h>
#include <string>
#include <ryml_all.hpp>
int main()
{
char yml_buf[] = R"(
foo: 1
bar: [2, 3]
john: doe
comment: |
abc
def
)";
ryml::Tree tree1 = ryml::parse_in_place(yml_buf);
auto s = ryml::emitrs_json<std::string>(tree1);
printf("%s\n", s.c_str());
}
I get this output:
{"foo": 1,"bar": [2,3],"john": "doe","comment": "abc
def
"}
The newline in the "comment" property should have been converted to a \n
.
Metadata
Metadata
Assignees
Labels
No labels