I have a json object as shown.
this.model = {
"cellType": "RemoveCell",
"maxWidth": "800px",
"items": {
"columns" : [
{"attribute": "existingStrings", "title": "Existing Strings"},
],
"rows" : [
{"existingStrings": this.stringList},
]
}
},
this.stringList is an array of strings (of varying size). How do declare this.stringList in the JSON object so that it behaves in this manner below?
this.model = {
"cellType": "RemoveCell",
"maxWidth": "800px",
"items": {
"columns" : [
{"attribute": "existingStrings", "title": "Existing Strings"},
],
"rows" : [
{"existingStrings": this.stringList[0]},
{"existingStrings": this.stringList[1]},
{"existingStrings": this.stringList[2]},
...
...
{"existingStrings": this.stringList[n]},
]
}
},
I want "rows" to contain an array of objects (one object for each element in stringList). Thanks
foor looponthis.model.items.rows.existingStrings.length, and build the array of objects you need