I have a strange problem with a string that I am trying to parse as Json. In the database, the json is saved in the following way
{'Sales Package': '1 Ring, 1 Ring Gift Box, Ring Certificate'}
typeof = string
When I try to use Object.keys, it won't work because it is seen as a string. If I try to parse it, I get the following error
{'Sales Package': '1 Ring, 1 Ring Gift Box, Ring Certificate'}
[1] ^
[1]
[1] SyntaxError: Expected property name or '}' in JSON at position 1
My code
metaData.meta_data.attributes.forEach((attribute: string) => {
console.log(JSON.parse(attribute));
console.log(attribute);
//console.log(Object.keys(attribute));
});
An idea for a solution? I have searched for similar problems but they were of no use to me