samedi 26 septembre 2015

JSON Node.JS buffer seperate json entities

I am using MangoDB and upon querying my username, I get this response which is in JSON context. (there may be a simpler way to do this. but I need to be able to access each variable individually. Not to mention decrypt the password then verify it to what the user entered.

How I plan to do this is with IF statements, should work for my principle.

This JSON output is stored in the variable user

>[ { _id: 560734a53e04afd4029ab020,
username: 'archlinuxusa',
password: '9cb1e3525d22f14efd',
server: 'ftb',
admin: true,
__v: 0 } ]

when I use something like, console.log(user._id) or console.log(user.password) I get undefined.

Any ideas on this issue?

Thank you!

Aucun commentaire:

Enregistrer un commentaire