github中该问题的链接:issue
the json file is:
{
"response": {
"count": 246,
"items": [
{
"id": 456239356,
"album_id": -15,
"owner_id": 223134400,
"sizes": [
{
"type": "m",
"url": "https://sun9-25.u...4c5/FPhcIYb3UH0.jpg",
"width": 97,
"height": 130
},
{
"type": "o",
"url": "https://sun9-41.u...4c7/JDqz1u_L8p4.jpg",
"width": 130,
"height": 173
},
{
"type": "p",
"url": "https://sun9-61.u...4c8/DB5DZsOldK4.jpg",
"width": 200,
"height": 267
},
{
"type": "q",
"url": "https://sun9-4.us...4c9/ckrBy4eD8-c.jpg",
"width": 320,
"height": 427
},
{
"type": "r",
"url": "https://sun9-10.u...4ca/YMxebK1MdXE.jpg",
"width": 450,
"height": 600
},
{
"type": "s",
"url": "https://sun9-14.u...4c4/3SBIzASVRfg.jpg",
"width": 56,
"height": 75
},
{
"type": "x",
"url": "https://sun9-43.u...4c6/M2kNQnDOHEU.jpg",
"width": 450,
"height": 600
}
],
"text": "",
"date": 1531926387
},
{
"id": 456239361,
"album_id": -15,
"owner_id": 223134400,
"sizes": [
{
"type": "m",
"url": "https://sun9-47.u...1b6/diTkAYuSeEY.jpg",
"width": 97,
"height": 130
},
{
"type": "o",
"url": "https://sun9-5.us...1bb/UJd8Jlha1Ow.jpg",
"width": 130,
"height": 173
},
{
"type": "p",
"url": "https://sun9-49.u...1bc/FF8SEu_oBt0.jpg",
"width": 200,
"height": 267
},
{
"type": "q",
"url": "https://sun9-47.u...1bd/hXZmMKhYgFw.jpg",
"width": 320,
"height": 427
},
{
"type": "r",
"url": "https://sun9-37.u...1be/dcyHZoEEfBQ.jpg",
"width": 510,
"height": 680
},
{
"type": "s",
"url": "https://sun9-28.u...1b5/hW5bO1WXZ04.jpg",
"width": 56,
"height": 75
},
{
"type": "w",
"url": "https://sun9-31.u...1ba/m3ZFNMnSdUg.jpg",
"width": 1620,
"height": 2160
},
{
"type": "x",
"url": "https://sun9-54.u...1b7/Tzx4N7wD3YE.jpg",
"width": 453,
"height": 604
},
{
"type": "y",
"url": "https://sun9-11.u...1b8/dhmIRt3eZ8c.jpg",
"width": 605,
"height": 807
},
{
"type": "z",
"url": "https://sun9-37.u...1b9/3iavgJV9YWQ.jpg",
"width": 810,
"height": 1080
}
],
"text": "",
"date": 1531935090
}
]
}
}
the extract code :
json j = json::parse("your_file.json");
for (const auto& item : j["response"]["items"])
{
int id = item["id"];
}