get jsonString(): string { this.loading = false; this.cdr.markForCheck(); return JSON.stringify(this.data, null, '\t'); } set jsonString(data: string) { this.data = JSON.parse(data); } JSON.stringify is taking too long to complete since my data is huge and it's blocking my UI, I'm using a spinner loader and it's stuck . I want the loader to spin till the data is ready to show <button id="btnGetJson" pButton icon="fa fa-file-code-o" pTooltip="Json Viewer" tooltipPosition="bottom" class="p-button-secondary" (click)="handleJsonViewerOpen()" ></button> <p-dialog [(visible)]="jsonView" header="Json Viewer({{ header }})" positionTop="0" styleClass="custom-dialog" responsive="true" [closable]="false" > <loader [visible]="loading" *ngIf="!jsonViewerLoader"></loader> Continue reading...