0

我写了一个查询,它返回一个结果集,如下所示,

result = [
{"total_requests" : "4", "requesttimestamp" : null}, 
{"total_requests" : "2", "requesttimestamp" : null}, 
{"total_requests" : "4", "requesttimestamp" : null}, 
{"total_requests" : "7", "requesttimestamp" : null}, 
{"total_requests" : "1", "requesttimestamp" : 1.37412742E9}, 
{"total_requests" : "1", "requesttimestamp" : 1.37412781E9}, 
{"total_requests" : "1", "requesttimestamp" : 1.374127424E9}
]

当尝试通过这个迭代

result[i]["total_requests"] ,result[i]["requesttimestamp"] 

得到它给出的未定义的结果对。

那么如何分别检索值对呢?

4

1 回答 1

1

这可以通过 result[i].total_requests , result[i].requesttimestamp 访问

于 2013-07-19T05:07:29.853 回答