json库 rapidjson的简单使用
读取json文件到rapidjson格式
#include "rapidjson/document.h" // rapidjson's DOM-style API
#include "rapidjson/prettywriter.h" // for stringify JSON
rapidjson::Document readJson(const char* jsonFile)
{
std::ifstream t;
long long length = 0;
t.open(jsonFile); // open input file
if (!t.is_open())
{
LOGGING_ERROR("Config file open error, file path : %s", jsonFile);
}
t.seekg(0, std::ios::end); // go to the end
length = t.tellg(); // report location (this is the length)
t.seekg(0, std::ios::beg);// go back to the beginning
char* configData = new char[length];// allocate memory for a buffer of appropriate dimension
if (!configData