I am working with a Json array structured like this:
Test = [
{
"adj" : [
{
"nodeTo" : "x",
"nodeFrom" : "y",
"data":
{
"$type" : "line",
"$color" : "#A989BC",
"$value" : "number"
}
}
],
"id" : "id1",
"name" : "name1"
},
{
"adj" : [ ..... ] // There are multiple elements in the Test array
I am attempting to iterate through all the elements in the Test array. Here is my current approach:
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"]);
}
However, I am encountering issues with this method and it is not producing the desired results. Any help or suggestions would be greatly appreciated. Thank you in advance :)