Closed
Description
Json::Value v(Json::stringValue);
I would have expected this declaration to store an empty string in v
, but instead the internal string pointer is set to 0
and serialisation goes awry:
#include <json/json.h>
#include <iostream>
int main()
{
Json::Value root;
root["member"] = Json::stringValue;
Json::StreamWriterBuilder builder;
builder["indentation"] = "";
auto writer = builder.newStreamWriter();
writer->write(root, &std::cout);
std::cout << '\n';
}
// Output: {"member":}
// Expected: {"member":""}