我有以下 json 数据:
{
"images": [
{
"candidates": [
{
"confidence": 0.80836,
"enrollment_timestamp": "20190613123728",
"face_id": "871b7d6e8bb6439a827",
"subject_id": "1"
}
],
"transaction": {
"confidence": 0.80836,
"enrollment_timestamp": "20190613123728",
"eyeDistance": 111,
"face_id": "871b7d6e8bb6439a827",
"gallery_name": "development",
"height": 325,
"pitch": 8,
"quality": -4,
"roll": 3,
"status": "success",
"subject_id": "1",
"topLeftX": 21,
"topLeftY": 36,
"width": 263,
"yaw": -34
}
}
]
}
我需要检查subject_id
上述 json 数据中是否存在。为此,我在下面做了:
auto subjectIdIter = response.find("subject_id");
if (subjectIdIter != response.end())
{
cout << "it is found" << endl;
}
else
{
cout << "not found " << endl;
}
我该如何解决这个问题。谢谢