从json中读取嵌套值[重复]

问题描述 投票:0回答:1

这个问题在这里已有答案:

在图像上您可以看到我想要阅读的内容

console.log("exact val = " + json._array.loftybot.spells.name)

它给出了[TypeError: Cannot read property 'spells' of undefined]你可以在json的终端结构中看到

如何进入这些价值观?我想将值从json保存到数组const json = new ObservableArray然后在我的程序中使用所有这些值

enter image description here

javascript arrays json vue.js nativescript
1个回答
1
投票

json._array[0].loftybot.spells.name怎么样?你的_array上的索引为0,并在嵌套的json上更进一步。在MDN

© www.soinside.com 2019 - 2024. All rights reserved.