I'm developing a node.js app which connects into a MYSQL database, gets some info, converts it into JSON format and write it into the browser.
I'm using the mysql npm (https://www.npmjs.org/package/mysql).
connection.query("select tact, digits, mode from table1 where id = '"+id+"'", function(err, rows, fields){
if (err){
console.log(err);
throw err;
}
var objToJson = rows;
objToJson.response = response;
var finalresponse = JSON.stringify(objToJson);
});
And the final response is:
[{"tact":0,"digits":5,"mode":"on"}]
The point is that I only want to recieve something like (but it should be json parsed):
[{0,5,"on"}]
How could I do it? Is it possible?
Thanks guys.