我有一個 ajax 調用,它在返回時接收一個 json 編碼的對象。success: function (response) {jsonArrayResponse = jQuery.parseJSON(response["data"]);autoSearchValue = jsonArrayResponse['autoresult'];我希望能夠訪問解碼的不同部分。這是一些樣本回報{"success":true,"message":null,"messages":null,"data":"{\"errorText\":\"\",\"autoresult\":[{\"firstname\":\"Annon\",\"lastname\":\"Brooks\",\"date_of_birth\":\"1975-12-23 00:00:00\",\"id\":\"1\"},{\"firstname\":\"Josh\",\"lastname\":\"Ferns\",\"date_of_birth\":\"2000-09-02 00:00:00\",\"id\":\"2\"},{\"firstname\":\"Alan\",\"lastname\":\"Templeton\",\"date_of_birth\":\"1975-08-02 00:00:00\",\"id\":\"3\"}}]}我發現我可以通過以下方式訪問名字autoSearchValue[0]['firstname'];但我不知道如何遍歷其他名字值。我猜一旦你知道怎么做就很簡單了。任何幫助都會非常感謝
從 json 訪問對象
一只斗牛犬
2021-12-12 11:06:25