0
난에서 JSON 파일 (문자열)를 만들 수있는 방법 :벡터 <string> 데이터에서 rapidjson 라이브러리를 사용하여 json 파일을 만드는 방법은 무엇입니까?
vector<string>m_paths
내가 가진 코드 : 나는 라이브러리를 rapidjson 사용해야하며 내가 할당을 만든 후 무엇을해야하는지 모르는
rapidjson::Document jsonfile;
jsonfile.SetObject();
rapidjson::Document::AllocatorType& jsonallocator = jsonfile.GetAllocator();
std::vector<String>::iterator itm;
rapidjson::Value paths(rapidjson::kArrayType);
for(itm = m_paths.begin(); itm != m_paths.end(); ++itm)
{
//rapidjson::Value jValueConverting;
// jValueConverting.SetString(GetLogRpl().c_str(), (rapidjson::SizeType)GetLogRpl().size(), jsonallocator);
}
jsonfile.AddMember("paths", paths, jsonallocator);
rapidjson::StringBuffer jsonstring;
rapidjson::Writer<rapidjson::StringBuffer> jsonwriter(jsonstring);
jsonfile.Accept(jsonwriter);
String fullJsonString = jsonstring.GetString();
return fullJsonString;
. 어떤 도움을 주셔서 감사합니다!
http://stackoverflow.com/help/how-to-ask를 읽고 질문에 나와있는 표준을 충족 시키십시오. – jbrown
할당 자에 대해 걱정할 필요가 없습니다. 그렇게한다면, rapidjson은 매우 나쁘게 설계되었습니다. Allocators는 일반 힙에 액세스 할 수없는 고급 프로그래밍 용입니다. –