string StrUtil::map2jsonstrObject(const map<string, Json::Value>& map_info)
{
Json::Value jObject;
for (map<string, Json::Value>::const_iterator iter = map_info.begin(); iter != map_info.end(); ++iter)
{
Json::ValueType valType = jObject.type();
if (valType == Json::stringValue && iter->second.asString().find(",") != string::npos)//同名参数转换为数组
{
jObject[iter->first] = Json::arrayValue;
std::vector<std::string> vals;
SplitBySeparator(iter->second.asString(), ",", vals);
for (std::vector<string>::iterator iterV = vals.begin(); iterV != vals.end(); iterV++)
{
jObject[iter->first].append(*iterV);
}
//jObject[iter->firs
json字符串与map<string,Json::Value>互转 (JsonCpp中的)
最新推荐文章于 2025-04-26 09:45:00 发布