像这样的JSon数据
{
"timestamp": 1452658101628,
"resources": [
{
"uri": "/match/4236",
"resource": "/match/4236",
"body": {
"matchid": 4236,
},
{....}
]
}
代码如下:
string jsonString;
Json::Value value;
reader.parse(jsonString, value);
string matchId = value["resources"][0]["body"]["matchid"].asString();
当我制作时,我得到以下错误:
error: ambiguous overload for 'operator[]' in 'value.Json::Value::operator[](((const char*)"resources"))[0]'
../include/json/value.h:277: note: candidates are: Json::Value& Json::Value::operator[](Json::Value::UInt)
../include/json/value.h:281: note: const Json::Value& Json::Value::operator[](Json::Value::UInt) const
../include/json/value.h:294: note: Json::Value& Json::Value::operator[](const char*)
../include/json/value.h:296: note: const Json::Value& Json::Value::operator[](const char*) const
../include/json/value.h:298: note: Json::Value& Json::Value::operator[](const std::string&)
../include/json/value.h:300: note: const Json::Value& Json::Value::operator[](const std::string&) const.
我可以解决这个并得到我的matchId吗?