rapidjson extract key and value rapidjson extract key and value json json

rapidjson extract key and value


Suppose V is a JSON object which has key-value object. You can retrieve data like this.

const rapidjson::Value& V;for (Value::ConstMemberIterator iter = V.MemberBegin(); iter != V.MemberEnd(); ++iter){    printf("%s\t", iter->name.GetString());    printf("%s\t", iter->value.GetString());}


m is Member*, where Member is

struct Member {     GenericValue<Encoding, Allocator> name;     //!< name of member (must be a string)    GenericValue<Encoding, Allocator> value;    //!< value of member.};

Thus the proper getter for the key is m->name.

That much is obvious from "rapidjson/document.h". I can't test it further without a self-contained example (https://stackoverflow.com/help/mcve, http://www.sscce.org/).