i am trying to parse a list of json objects from a string and it kept giving me errors about the use of quotations and double quotations so i replaced all of them and now it is giving me this weird error when the syntax looks good, maybe the problem is me i just can’t see how the string may be wrong
const { row } = props;
row.reciept = '{"data": ' + row.reciept + '}'
console.log(row.reciept)
console.log(JSON.parse(row.reciept.replace("'", '"')))
console output:
{"data": [{'id': 4, 'name': 'test msg', 'description': '12', 'price': 123, 'quantity': 11, 'discount': 1, 'user': 1, 'shop': 1, 'amount': 5}, {'id': 3, 'name': 'Chipsy', 'description': '.', 'price': 5, 'quantity': 1000, 'discount': 0, 'user': 1, 'shop': 1, 'amount': 2}]}
error:
SyntaxError: Unexpected end of JSON input