I generate a JSON file using POCO library like this:
void writeToFile()
{
Poco::JSON::Object::Ptr json = new Poco::JSON::Object;
json->set("name", "foo");
json->set("address", "bar");
std::ostringstream oss;
Poco::JSON::Stringifier::stringify(json, oss);
std::ofstream ofs("output.json");
if (ofs.is_open() == true)
{
ofs << oss.str();
ofs.close();
}
}
The output.json contains:
{"name":"foo","address":"bar"}
Is there any way on POCO to beautify a JSON?
So that the output would be like:
{
"name" : "foo",
"address" : "bar"
}