I try setting a Value to string, using SetString, but when I try to get it, via GetString(), some random output shows up. Code:
someDoc[someObjKey].AddMember(someStringKey.c_str(), someStringValueAFunctionReturns.c_str(), someDoc.GetAllocator());
std::cout << someDoc[someObjKey][someStringKey.c_str()].GetString();
What am I doing wrong?
OK, after browsing trough the source code, documentation and mostly every mention of rapidjson over the internet, I found something interesting:
There are a couple of functions
SetString, and this is the one you have to use:After that, you can call
GetString()on theValueand it returns the original string.