【发布时间】:2021-03-17 23:53:01
【问题描述】:
您好,我将此 JSON 作为字符串作为 API 调用的响应
{
"friends": {
"data": [],
"summary": {
"total_count": 42
}
},
"id": "111111111111111"
}
我想获取 friends.data 和 friends.summary.total_count。 类似的东西:
for (int i = 0 ; i < friends.summary.total_count ; i++)
{
myAmazingArray.pushback(friends.data[i]);
}
我认为 total_count 是数组中的内容数。
我也知道,为了获得“id”,我必须这样做:json['name']
【问题讨论】: