问题
Jsoncpp FastWriter method why last line append blank? It's for there an method Json::StreamWriterBuilder and indentation field. I how to use this method? for no lines.
Fixed please look answer.
Dont like code:
Json::Value root;
root["name"] = "Arda";
Json::FastWriter out;
std::cout << "'" << out.write(root) << "'" << std::endl;
// Result:
'{"name": "Arda"}
'
回答1:
I now StreamWriterBuilder method using for nice result !
Json::StreamWriterBuilder wbuilder;
wbuilder["indentation"] = "";
std::cout << "'" << Json::writeString(wbuilder, root) << "'" << std::endl;
来源:https://stackoverflow.com/questions/42734162/jsoncpp-fastwriter-right-trim