I want to do what I consider very basic in rapidjson. I want to start a new object and then add members to that object - but I have a hard time finding out how to do it properly. I start like this:
rapidjson::Value obj;
obj.SetObject();
rapidjson::Value jName(name, this->rapDoc.GetAllocator());
this->rapCurrent->AddMember((jName).Move(), obj, this->rapDoc.GetAllocator());
next I want to make the this->rapCurrent point to the new created object member. The only way I found to make this work is
rapidjson::Value *lastAdded;
rapidjson::Value::ConstMemberIterator it;
for (rapidjson::Value::ConstMemberIterator it = this->rapCurrent->MemberBegin();
it != this->rapCurrent->MemberEnd(); it++) {
lastAdded = (rapidjson::Value *)&it->value;
}
this->rapCurrent = lastAdded;
which looks very complicated to me for such an easy task. Does anybody perhaps know how to this more simple?
Thanks a lot!
Timo