My json object has a list in it and I would like to iterate through the elements of the list I saw the following post Iterating through objects in JsonCpp , but this did not work for me
My json object:
{
"name": ["str1",str2" ... ]
}
The code that I have and is not working
Json::Value names= (*json)["name"];
for( Json::ValueIterator itr = names.begin() ; itr != names.end() ; itr++ ) {
string name = *itr.asString();}
I am getting the following error
cannot convert from 'Json::Value' to 'std::basic_string<_Elem,_Traits,_Ax>
I am sure the elements are string because calling string name = names= (*json)["name"][0].asString()
is working