0
我有這個作爲響應如何閱讀嵌套數組
[
{
"name": "Large, 100 Ml",
"image": "http://hostip:8080/OrderSnacks/JSON_images/icecream_cup_vanilla.jpg",
"quantity": "1",
"price": "75",
"toppings": []
},
{
"name": "Regular, 50 Ml",
"image": "http://hostip:8080/OrderSnacks/JSON_images/icecream_cup_vanilla.jpg",
"quantity": "2",
"price": "150",
"toppings": [
{
"name": "Regular, 50 Ml0",
"value": [
"Honey with Chocolate Sauce 10 ML"
]
},
{
"name": "Regular, 50 Ml1",
"value": [
"Honey with Chocolate Sauce 10 ML",
"Honey with Carmel 10 ML"
]
}
]
}
]
如何我可以讀取澆頭數組值?
我試圖讀取這樣
for (var n = 0; n < toppins.values.length; n++)
{
alert(toppins.values[n]);
}
但它給errror無法讀取的不確定
財產可能有人請幫助我在此。
是吧'toppins'或'澆頭'?此外,它上面有兩層。 –
「澆頭」是一個數組。它沒有「價值」屬性,它的元素就是這樣。 –