我已经阅读了有关这个主题的其他几个问题,他们给我带来了更多,但不是我想要的地方。我有一个集合对象,我用以下代码提醒:
alert(JSON.stringify(oResponse.Result, null, 4));
这给了我以下输出(这只是一部分):
{
"@Object": "Collection/MessageCollection",
"@Count": 20,
"@Collection": [
{
"@Object": "Object/MessageListItem",
"Folder": "INBOX",
"Uid": 37445,
"Subject": "NEW: Easily sync in-store and online inventory with Lightspeed POS",
"MessageId": "<2c1434dc56f9506bf3c3ecd21ecf0de6023.20150916163348@mail69.suw11.mcdlv.net>",
"Size": 71515,
"TextSize": 28739,
"InternalTimeStampInUTC": 1442421281,
"ReceivedOrDateTimeStampInUTC": 1442421281,
"TimeStampInUTC": 1442421281,
"From": [
{
"@Object": "Object/Email",
"DisplayName": "WooCommerce",
"Email": "mailers@woothemes.com"
}
],
"To": [
{
"@Object": "Object/Email",
"DisplayName": "",
"Email": "info@xxx.nl"
}
正如您可能看到的那样,集合对象中有电子邮件。我想迭代它们并提取'Uid'和'From e-mail'。我试过这个,但它给了我一个未定义的:
for(var item in oResponse.Result) {
alert(item[0].Uid);
}
任何可以给我一些建议的人?谢谢!