i am getting frustrated because i have a method which receives a Json in the body.
var user = JSON.parse(req.body.user);
console.log("user: " + user); //1
console.log("user image: " + user.image); //2
When i check the terminal u got these:
1:
user: {"email":"abc@outlook.com","firstname":"ABC","lastname":"DEF","lastname2":"GHI","phone":"999999999","doctype":"1","numdoc":"999999999","password":"12345678","image":"-","sessionToken":"-","roles":[]}
but in second line I got:
2:
user image: undefined
In another point, I tried to change the image property, and I got these:}
nombre = 'abc';
user.image = nombre;
console.log("filename:" + nombre);
console.log("new name: " + user.image );
In terminal I got:
filename:abc
new name: undefined
So my question is... an object from JSON.parse function can't be changed?
What am I doing wrong.
Regards