Lewis Smith
Lewis Smith

Reputation: 1345

vue-qrcode-component can't keep the quotes

I am trying to create a JSON string and then turn it into a QRCode using vue-qrcode-component. This is where I am creating the string:

this.qrCode = "{‘type’:’serialNumber’,’id’:25434,’stock_id’:736,’stock_order_id’:’655’}";

And then in the template:

<qr-code :text="qrCode"></qr-code>

But I keep getting this when scanning the generated qr:

{type:serialNumber,id:25434,stock_id:736,stock_order_id:655}

So I am losing the quotes which I need for it to be formatted correctly. I have tried escaping ' with ` but this hasn't worked

Any suggestions

Upvotes: 1

Views: 405

Answers (1)

Lewis Smith
Lewis Smith

Reputation: 1345

Using JSON.stringify worked a treat

Upvotes: 1

Related Questions