简体   繁体   中英

Convert json to javascript variable

I'm new to node and javascript. Sorry if this is an obvious question.

I retrieve data from mysql using the node,js code below:

     var quer = connection.query('select password from users where  mail="'+ so +'" ',function(err, result, fields){

               console.log(result);

        });

Result is this

    [{password:'123456'}]

I want to get it as only 123456, how can I achieve that?

这很容易:

console.log(result[0].password)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM