I have a returned string from my server and I want to parse it into a JSON object, the following is the string and what I am doing :
stringToParse = "\"{'female': 16, 'brand': 75, 'male': 8}\""
dataJson = JSON.parse(stringToParse)
console.log(dataJson)
console.log(dataJson.male)
I'm getting this as output :
{'female': 16, 'brand': 75, 'male': 8}
undefined
so I can't access the male, female, and brand objects within the JSON.
dataJsonis a string