Im trying to get an object array from my MySql database, however I keep getting the result of "undefined" and I do not know why my code:
database.query(sql, (err, rows)=>{
var data = Object.values(JSON.parse(JSON.stringify(rows)))
console.log(data[0].type)
})
Whenever I console log my "data" variable I get:
[
{
data: '[{"type": "c#", "script": "csharp script"}, {"type": "javascript", "script": "javascript script"}, {"type": "html", "script": "html script"}]'
}
]
which seems correct to me but Im not sure about what to do now. Any help would be greatly appreciated