I’m trying to utilize the visulizer module to display information from a JSON response.
I’m using the example code from the documentation creating a table. In the example the blob is:
{
"contacts": [
{
"name": "{{$randomFullName}}",
"email": "{{$randomEmail}}"
},
{
"name": "{{$randomFullName}}",
"email": "{{$randomEmail}}"
},
{
"name": "{{$randomFullName}}",
"email": "{{$randomEmail}}"
},
{
"name": "{{$randomFullName}}",
"email": "{{$randomEmail}}"
}
]
}
And the test code references the “name” objects simply with {{name}} in the #each loop for response.data.contracts
My JSON looks something like this:
{
"payload": [{
"object1": 0,
"object2": 0,
"children": [{
"childobject1": 1,
"childobject2": 2,
"children": [{
"childobject-a": 10,
"childobject-b": 20
}],
"childobject4": 3,
"pool_member": [{
"childobject-x": 4,
"childobject-y": 5
}],
"childobject5": 8
}],
"object4": 100,
"object5": 110,
"objectkey": "test1"
},
{
"object1": 0,
"object2": 0,
"children": [{
"childobject1": 1,
"childobject2": 2,
"children": [{
"childobject-a": 10,
"childobject-b": 20
}],
"childobject4": 3,
"pool_member": [{
"childobject-x": 4,
"childobject-y": 5
}],
"childobject5": 8
}],
"object4": 100,
"object5": 110,
"objectkey": "test2"
}
]
}
But I can’t reference for example {{children.childobject2}} (nor using {{children[0].childobject2}} ) in an #each loop for response.payload inside my template declaration.
I suspect it has something to do with children being another array, but I can’t find the right syntax for this. Any hint as to how this can be accomplished?