Jsoncpp FastWriter right trim

2019-06-02 05:23发布

问题:

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;


标签: c++ jsoncpp