我有一个 json 数组,我需要提醒其中的一个值。 该对象看起来像这样:
Test = [
{
"adj" : [
{
"nodeTo" : "x",
"nodeFrom" : y,
"data":
{
"$type" : "line",
"$color" : "#A989BC",
"$value" : "number"
}
}
],
"id" : "id1",
"name" : "name1"
},
{
"adj" : [ ..... ] // I have many element in the Test array
我想要的是提醒“adj”数组中存在的“data”数组中存在的值。 我试过这个:
alert(Test[0]["adj"]["data"]["value"]);
但是它不起作用。
提前致谢:)
最佳答案
adj 是一个数组:
alert(Test[0]["adj"][0]["data"]["value"]);
关于javascript - 如何警告 json 数组中的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12528708/