{
id: 8,
customerName: "xyz",
customerMobileNumber: "123456789",
customerBillingAddress: "xyz address",
customerShippingAddress: "xyz address",
customerProductPurchasedDate: "2021-11-09T09:07:00.000Z",
customerGstNumber: "xyz",
customerHsnNumber: "xyz",
addedInvoiceProductDetails: "[{"productquantity":"5","productprice":"5","productgst":"5","productname":"xyz","producttotalprice":"26.25","id":"2021-11-13T09:08:20.071Z"}]",
created_at: "2021-11-13T09:08:25.000000Z",
updated_at: "2021-11-13T09:08:25.000000Z"
},
The information above is retrieved from my project's API[http://127.0.0.1:8000/api/invoice_details/8]. The problem I am encountering is that the parameter addedInvoiceProductDetails is received as a string. This prevents me from mapping it as an object. How can I convert this string to an object and then map it accordingly?
Note: The response I get from the API for the addedInvoiceProductDetails parameter looks like this:
[{"productquantity":"1","productprice":"1000","productgst":"18","productname":"Street Light","producttotalprice":"1180","id":"2021-11-18T12:11:31.137Z"},{"productname":"Solar","productquantity":"2","productprice":"50","productgst":"10","producttotalprice":"110","id":"2021-11-18T12:11:43.935Z"}]
Although the response from the API seems to be already parsed, when I check its typeof, it still shows as a string.
I would greatly appreciate any help in resolving this issue as I have been stuck on it for the past 2 days.