rapidjson SetString - GetString

c++, rapidjson

Solution

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:

GenericValue& SetString(const Ch* s, Allocator& allocator)

After that, you can call `GetString()`on the `Value`and it returns the original string.

Problem

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?

Original source