0
簡單的ajax調用我的服務器給了我這個json對象。如何獲取componentName的值或執行時間?如何通過JavaScript獲取深度嵌套的json對象中的任何鍵的值?
{"data":[{"date":"20131212","time":"103053","componentName":"xxxx","qualityIndexScore":{"noOfLinesOfCode":"47,214","coverage":"61.8%","violations":{"info":"43","minor":"215","major":"19","critical":"98"}},"liveScore":{"noOfErrors":"20313","executionTime":"2938596.2450000006"},"systemHealthScore":{},"dataBaseHealthScore":{}},{"date":"20131211","time":"110504","componentName":"yyyy","qualityIndexScore":{"noOfLinesOfCode":"342","coverage":"1.8%","violations":{"info":"21","minor":"53","major":"3","critical":"2"}},"liveScore":{"noOfErrors":"462","executionTime":"9298.1225000003"},"systemHealthScore":{},"dataBaseHealthScore":{}}]}
'obj.data'是對象的數組。所以,第一個是'obj.data [0] .componentName'。 –
[Access/process(嵌套)對象,數組或JSON]可能的重複(http://stackoverflow.com/questions/11922383/access-process-nested-objects-arys-or-json) –