My JSON is stored in MySQL as this....
{'profile':'sweet', 'count':38},{'profile':'bitter', 'count':31},{'profile':'green', 'count':22}
When it's being returned as JSON from Express, it looks likes this...
[{"JSON":"{'profile':'sweet', 'count':38},{'profile':'bitter', 'count':31},{'profile':'green', 'count':22}"}]
which is valid JSON according to JSONLint.com
What throws me is iterating over it in a HTML javascript...
I have this in Javascript ....
fProfiles_JSON = JSON.parse(xhr.responseText);
console.log('Type of '+ typeof fProfiles_JSON); //yields "object"
console.log('My object', fProfiles_JSON);
console.log('LENGTH ', fProfiles_JSON.length); // Yields "1"
I get that I have to somehow iterate over this object type to get at the "profile" and "count" values but honestly, I'm not sure how since the length value is "1". I know this is probably dead simple and I'm just not seeing it. Can someone point me in the right direction?
xhr- what is returned for it?xhr.responseText? what is that exactly?