I've a table in a SQL DB in which I store a JavaScript object like this:
{content: ['First paragraph','second paragraph']}
I get it from DB and try to pass to a function which needs an object formatted like it:
this._schedaService.getObjectFromDBToPrintPdf().subscribe(data => {
pdfMake.createPdf(data).download('tempPdf.pdf');
});
The problem is that data
is always a string.
I've tried JSON.parse(data)
but (obviously) doesn't work.
If I write
cont temp = {content: ['First paragraph','second paragraph']};
it works.
Does anyone have a good idea?