I am generating a graph through JSON. I want to include every element of my Array in it. As you can see I am hard coding the array elements currently (relation[0], relation[1]). I want to iterate through the whole array. How ever, I obviously can't put for loop in JSON. If I try to include only array itself (relation), my graph wont generate because the whole array is wrapped with [ ] brackets. So instead of adding relation[0], relation[1], ..... I'd like that to be added automatically based on array size.
this.graph.fromJSON({
"cells": [{
"type": "qad.Question",
"size": {"width": 201.8984375, "height": 125},
"optionHeight": 30,
"questionHeight": 45,
"paddingBottom": 20,
"minWidth": 150,
"inPorts": [{"id": "in", "label": "In"}],
"outPorts": [],
"position": {"x": 300, "y": 38},
"angle": 0,
"question": objectName2,
"options": objectCol2,
"id": "1849d917-8a43-4d51-9e99-291799c144db",
"z": 2
}, relation[0],relation[1]
]
});