We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello all , just started to use the this great lib and i have question : i have this simple part of json :
"foo" : [{ "Name" : "t1", "things" : [] }, { "name" : "t2", "things" : [] } ],
Array that contains objects , this is part of much larger json rapidjson::Value& foo = jsonValue["foo"]; constructFoo(&foo);
This is the function that iterate the array of objects
constructFoo(rapidjson::Value* jsonValue) { for (rapidjson::SizeType i = 0; i < jsonValue->Size(); i++) { rapidjson::Value& fooObj = jsonValue[i]; } }
The jsonValue->Size() value is 2 but the fooObj keep return the all Array foo and not the object per index
This on the other hard works fine ,
for (rapidjson::Value::ConstValueIterator itr = jsonValue->Begin(); itr != jsonValue->End(); ++itr) { rapidjson::Type tt = itr->GetType(); // Is type Object }
What is the difference ? why simple index based loop don't work ?
The text was updated successfully, but these errors were encountered:
Since jsonValue is a pointer in:
jsonValue
constructFoo(rapidjson::Value* jsonValue)
So you need to dereference it to use operator[], e.g.
operator[]
rapidjson::Value& fooObj = (*jsonValue)[i];
Sorry, something went wrong.
No branches or pull requests
Hello all , just started to use the this great lib and i have question :
i have this simple part of json :
Array that contains objects , this is part of much larger json
rapidjson::Value& foo = jsonValue["foo"];
constructFoo(&foo);
This is the function that iterate the array of objects
The jsonValue->Size() value is 2
but the fooObj keep return the all Array foo
and not the object per index
This on the other hard works fine ,
What is the difference ? why simple index based loop don't work ?
The text was updated successfully, but these errors were encountered: