【发布时间】:2019-06-30 13:21:30
【问题描述】:
这是我使用console.log(res)得到的结果
{d: Array(4)}
d: Array(4)
0: {__type: "Claim_Inbox+SubClaims", Claim_detail: 12, Claim_id: 123, …}
1: {__type: "Claim_Inbox+SubClaims", Claim_detail: 12, Claim_id: 124, …}
2: {__type: "Claim_Inbox+SubClaims", Claim_detail: 12, Claim_id: 125, …}
3: {__type: "Claim_Inbox+SubClaims", Claim_detail: 12, Claim_id: 126,…}
length: 4
__proto__: Array(0)
__proto__: Object
使用以下代码,我得到了键列表:值
var counter = 0;
$.each(res.d[counter ], function (key, value) {
console.log(key + ": " + value);
counter++;
});
如何读取像 Claim_id 这样的特定值?
我可以使用Switch(),但也许还有其他方法
【问题讨论】:
-
你对
res.d.forEach(console.log)有什么好处, -
你能发布原始 JSON 或源代码吗?
-
这里不能使用 .forEach
标签: javascript json