Я пытался преобразовать одну строку std :: string в объект rapidJson в следующем формате
{
"data":{
"value": "AB1234"
}
}
Я пытался
rapidjson::Document aJsonDocument;
aJsonDocument.SetObject();
rapidjson::Document::AllocatorType &aAllocator = aJsonDocument.GetAllocator();
rapidjson::Value aPsmJson(rapidjson::kStringType);
std::string aStr = "ABCDEF";
aPsmJson.SetString(aStr.c_str(), aAllocator);
aJsonDocument.AddMember("value", aPsmJson, aAllocator);
//jsonToString is a function to convert json document to string
std::string aInputJsonString = jsonToString(aJsonDocument);
std::cout << "Output: " << aInputJsonString ;
Это дает вывод {"value": "ABCDEF "}