I'm facing an issue while attempting to parse and stringify certain JSON data.
The error occurs on this specific line of code:
this.copyOfColumns = JSON.parse(JSON.stringify(Object.assign([], this.columns)));
Below is the complete @Input (using Angular 4):
@Input()
set gridColumns(gridColumnsArr: Array<object>) {
console.log('gridColumnsArr');
console.log(gridColumnsArr);
this.columns = this.sortActiveAndInactiveColumns(gridColumnsArr);
console.log('this.columns');
console.log(this.columns);
this.copyOfColumns = JSON.parse(JSON.stringify(Object.assign([], this.columns)));
console.log('this.copyOfColumns');
console.log(this.copyOfColumns);
}
Here are the details logged in the console for 'this.columns'...along with the subsequent errors: