bit of a junior dev here, i have a text area which will receive an input of an array of objects like so ..
[
{
utc: "xxxxxx",
battery_level: 12,
lat: 2345678,
lng: 234567,
},
{
utc: "xxxxxx",
battery_level: 12,
lat: 2345678,
lng: 234567,
}
]
the text area input converts it to string like..
'[\n {\n utc: "xxxxxx",\n battery_level: 12,\n… 12,\n lat: 2345678,\n lng: 234567,\n }\n]'
i need to convert that back to a javascript object. i have tried JSON.parse which throw an error 'unexpected token u at position 10' the u of utc because it is NOT a string key.
i have tried JSON.stringify to JSON.parse which still returns a string.
the project is using react with typescript. any help would be appreciated.