I have a problem with a json output values returning undefined.
JSON:
[ { ID: 2, user: 'ngx.daniel', password: 'password', admin: 'F' } ]
CODE:
console.log(res);
res = JSON.stringify(res);
console.log(res);
var user = {};
user.user = res.user;
user.password = res.password;
user.admin = res.admin;
console.log(user);
OUTPUT:
[ RowDataPacket { ID: 2, user: 'ngx.daniel', password: 'password', admin: 'F' } ]
[ { ID: 2, user: 'ngx.daniel', password: 'password', admin: 'F' } ]
{ user: undefined, password: undefined, admin: undefined }
JSON.stringifyreturns a string. Why do you expect a string to have auserproperty?[ { "ID": 2, "user": "ngx.daniel", "password": "Root_!$@#", "admin": "F" } ].