I have a Json array that looks like this:
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
And I need to pass through all the elements in Test.
I have done this:
list = [];
for (i = 0; i < Test.lenght; i++) {
if (x == Test[i]["name"])
list.push(x + "->" + Test[i]["adj"][0]["nodeTo"] + ":" + Test[i]["adj"][0]["data"]["$value"]);
}
But it is not working.
Thanks in advance 🙂
probably just a (very common) typo:
i < Test.length;