Rapidjson Write StringBuffer para arquivar

#include <rapidjson/writer.h>
#include <fstream>

int main()
{
  rapidjson::StringBuffer sb;
  rapidjson::Writer<rapidjson::StringBuffer> writer(sb);
  
  writer.StartObject();
  writer.Key("myKey");
  writer.Uint(123);
  writer.EndObject();
  
  std::ofstream ofs("output.json");
  ofs << sb.GetString();
  ofs.close();
  return 0;
}
Puzzled Panda