I have stored JSON in a database like under the accesssPoint field. It looks exactly like this:
{"mode": "client", "rate": 0, "ssid": "RMG", "signal": 0, "channel": 0, "password": "", "username": "[email protected]"}
I run a MYSQL query from within Node and for some reason I get this as output:
[{"accessPoint":"[{\"mode\": \"client\", \"rate\": 0, \"ssid\": \"RMG\", \"signal\": 0, \"channel\": 0, \"password\": \"\", \"username\": \"[email protected]\"}]"}]
when I use:
db.query('SELECT accessPoint FROM player_r WHERE id=?', [playerID], function (err, results) {
var secondQuery = [];
results.forEach(function (item) {
secondQuery.push(item);
});
res.send(results);
});
Could someone please help me to extract this JSON the correct way? Help would be GREATLY appreciated!