Trying to create JSONs on the fly for my application, but the JSON I recieve does not remain constant.
std::string ResponseJson::getValue(std::string filter, std::string filterName, std::string jsonIndex)
{
BOOST_FOREACH(boost::property_tree::ptree::value_type & arrayElement, root.get_child("message"))
{
std::string value = arrayElement.second.get<std::string>(filter);
if (value == filterName)
{
return arrayElement.second.get<std::string>(jsonIndex);
}
}
return "";
}
above code snippet works well but message
is the child which can be changed in different jsons so how can I make this function generic ?