Manohar Gunturu
Manohar Gunturu

Reputation: 125

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?

Upvotes: 0

Views: 110

Answers (1)

Jaroslav
Jaroslav

Reputation: 2303

It's easy:

console.log(result[0].password)

Upvotes: 2

Related Questions