I encountered an issue in my Angular 8 project where I create an object from a JSON, but there is a dynamic property whose name is unknown until runtime. This causes problems when trying to access the value of that dynamic property within another object, leading to compilation errors.
Is there a way to solve this problem?
let i = 0;
this.columns = [
{ name: 'total' },
];
do {
if (certainCondition) {
this.column.push({ name: res.data[i].text })
}
this.rows.push({
total: someNumber,
res.data[i].text: someValue
});
i++;
} while (res.data[i] != null)