Jsoncpp FastWriter right trim

依然范特西╮ 提交于 2019-12-08 05:58:24

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!