I am using JsonCpp to build a JSON object. Once the object is built, is there a way I can get the object as an std::string
?
You can use a Json::Writer to do exactly this, since I assume you want to save it somewhere so you don't want human readable output, your best bet would be to use a Json::FastWriter and then you can call the write
method with the parameter of your Json::Value (ie. your root) and then that simply returns a std::string
like so:
Json::FastWriter fastWriter;
std::string output = fastWriter.write(root);