1
我正在开发一个连接到MYSQL数据库的node.js应用程序,获取一些信息,将其转换成JSON格式并将其写入浏览器。Node.js mysql响应格式
我使用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);
});
,最终的回应是:
[{"tact":0,"digits":5,"mode":"on"}]
的一点是,我只希望收到类似的信息(但应JSON解析):
[{0,5,"on"}]
我怎么能做它?可能吗?
谢谢你们。