0
JSON을 반환하는 일부 날씨 API에서 데이터를 가져 오려고합니다. 목록의 모든 항목은 "레이블"이없는 노드로 간주되지만 여기에는 목록 안에 두 개의 노드가 들어 있습니다. root.get<string>("weather.description")
에 Node does not exist
오류가 발생했기 때문에 description
라벨에 어떻게 액세스합니까?Boost :: ptree - 목록에 포함 된 속성 트리 노드에 액세스
for (auto it: root.get_child("weather")) {
cout << it.first.data() << "+";
cout << it.second.data() << endl;
}
weather.json : (아무 것도 반환하지 않음) 내가을 시도 무엇
는
{
"weather": [
{
"id": "701",
"main": "Mist",
"description": "brume",
"icon": "50n"
},
{
"id": "502",
"main": "Sun",
"description": "soleil",
"icon": "50b"
}
]
}