Support line ending options#2085
Conversation
|
|
|
I think this can be done in output stream instead. |
I am not pretty much sure about it. But we are using rj::StringBuffer sb;
rj::PrettyWriter<rj::StringBuffer, rj::UTF8<>, rj::UTF8<>, rj::CrtAllocator, rj::kWriteNanAndInfFlag> handler(sb);
handler.SetLineEnding(le);
handler.SetFormatOptions(lf);
handler.SetIndent(indentChar, indentLen);
rj::Reader reader;
rj::StringStream ss(jsonText.c_str());
success = reader.Parse<someflags>(ss, handler) && sb.GetString();
Here, we are expecting that sb.GetString should provide pretty json with desired line ending option. |
|
@miloyip Is there anything needed from my end to get this accepted and merged? |
|
Hi. As mentioned previously, πdon't think this should be implemented at this level of abstraction. For example, if you write to string, and then output it as a file, it should do the conversion at file writing part, which is accomplished by lower level APIs. |
|
Hi @miloyip, I didn't fully understand your comment. However, what makes you think that rapidjson/include/rapidjson/prettywriter.h Lines 145 to 148 in 24b5e7a That said, I'll leave it up to you to accept or reject the solution. I've been using this approach for a long time in one of my other projects, and it has been working well. Please note that this change does not alter the default behavior—the line ending remains |
a7c2a91 to
f5fbfd3
Compare
No description provided.