我正在使用Amazon Web Services數據庫dynamodb。它返回AA JSON看起來liek這樣的:訪問JSON回覆
{"Responses":{"friends":[{"to_username":"u1","from_username":"u2"}]},"UnprocessedKeys":{}}
我需要朋友數組的長度並同時獲得單個值(例如to_username在數組的第一個元素是「U1」中的例子) 。
我已經試過這樣的事情:
console.log(data.responses.friends.length); //get length (data is the object I get returned from my async call
console.log(data.responses.friends.to_username[0]); //get to_username of the first element in the array
兩個返回undefined。
'respond!= Responses' – adeneo